我正在創建一個應用程序快捷方式。它工作正常。但我無法刪除這個快捷方式。如何刪除我的應用程序快捷鍵。在我的主屏幕中包含很多應用程序快捷方式。如何刪除..
如果可能請發送有關如何刪除應用程序快捷方式的信息。否則,如果它不可能發送原因。請回復你的回答,評論對我很有價值。謝謝。
我的示例代碼是在這裏...如何創建和刪除應用程序快捷方式到主屏幕?
Button btnShortcut = (Button) findViewById(R.id.btnCreateShortcut);
btnShortcut.setOnClickListener(new View.OnClickListener()
{
public void onClick(View arg0)
{
Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
shortcutintent.putExtra("duplicate", false);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.ic_launcher);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext() , MyActivity.class));
sendBroadcast(shortcutintent);
}
});
我的Android的Manifest.xml代碼是在這裏...
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
這是一個無證和不支持的技術。這不適用於所有主屏幕,因此不適用於所有設備。 – CommonsWare
謝謝。但是我的模擬器主屏幕包含多個相同的快捷方式。我能做什麼?如何刪除這個。 – Bala