这是网上搜到的一个包装好的方法,但是第三个参数怎么设置我不会。不知道怎么用这个方法
public void addShortcut(Parcelable icon, String name, Uri uri){ Intent intentAddShortcut = new Intent(ACTION_ADD_SHORTCUT); //添加名称 intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, name); //添加图标 intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon); //设置Launcher的Uri数据 Intent intentLauncher = new Intent(); intentLauncher.setData(uri); //添加快捷方式的启动方法 intentAddShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intentLauncher); sendBroadcast(intentAddShortcut);
解决方案
如果是网址的话URI 就是网址啊