如何创建文件或者目录的快捷方式到桌面? ES文件浏览器有个功能可以把单个文件或者目录在桌面上建立快捷方式,不知道是怎么做的.网上搜索了一下,全都是安装包建立快捷方式,没有目录或者单个文件的,请问这个应该怎么实现?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 网上的例子修改下 Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); //快捷方式的名称 shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); shortcut.putExtra("duplicate", false); //不允许重复创建 //假设是图片类型 File file=new File("/sdcard/IMG/1.jpg"); Uri mUri = Uri.parse("file://"+file.getPath()); Intent it = new Intent(Intent.ACTION_VIEW); it.setDataAndType(mUri, "image/*");//自己可以设置类型 shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, it); //快捷方式的图标 ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(MainActivity.this, R.drawable.icon); shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes); sendBroadcast(shortcut); 用你的方法做swf的快捷方式可以吗 请教!设置全屏无效,标题栏消失了,但是信息栏一直还在,很郁闷! mm生成apk eclipse配置SDK APK之间的进程通信 技术突破 android UI ListView 跪求:新浪微博Android开发视频教程真正的完整版 现在还能进行googleMap的开发吗? 如何识别安卓手机。前提:不安装 360、豌豆荚、某某手机助手 之类的软件 Android中ExpandListView下嵌套开源组件SwipeMenuListView的问题 怎么在NDK的makefile加入预编译宏 关于google static map
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
//快捷方式的名称
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
shortcut.putExtra("duplicate", false); //不允许重复创建
//假设是图片类型
File file=new File("/sdcard/IMG/1.jpg");
Uri mUri = Uri.parse("file://"+file.getPath());
Intent it = new Intent(Intent.ACTION_VIEW);
it.setDataAndType(mUri, "image/*");//自己可以设置类型
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, it);
//快捷方式的图标
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(MainActivity.this, R.drawable.icon);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
sendBroadcast(shortcut);