首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

创造和卸载快捷方式

2013-06-26 
创建和卸载快捷方式?卸载快捷方式:?写道/*** 卸载快捷方式*/void deleteShortcut() {Intent shortcut ne

创建和卸载快捷方式

?卸载快捷方式:

?写道/**
* 卸载快捷方式
*/
void deleteShortcut() {
Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, "卸载快捷方式"); //指定要卸载的快捷方式的名称
String action = "com.android.action.test";
String appClass = this.getPackageName() + "." + this.getLocalClassName();
ComponentName comp = new ComponentName(this.getPackageName(), appClass);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(action).setComponent(comp));

sendBroadcast(shortcut);

}?需要权限:<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />??

热点排行