1
A
回答
0
我不認爲這是有可能,但事實證明它是:adding shortcut to homescreen和LauncherShortcut from the API demos很酷
0
試試這個:
private void addShortcut() {
Intent addIntent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
addIntent.putExtra("duplicate", false);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getResources().getString(R.string.hello_world));
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(getApplicationContext(),
R.drawable.ic_action_search));
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext(),OtherActivity.class));
getApplicationContext().sendBroadcast(addIntent);
}
,你也需要一些權限,在你的menifest,像這個:
<uses-permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission
android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
相關問題
- 1. .net .vdproj - 應用程序快捷方式
- 2. 應用程序快捷方式
- 3. 離線應用程序快捷方式
- 4. 創建應用程序快捷方式
- 5. 移動設備上的Web應用程序快捷方式
- 6. 如何關閉新的Android 7.1應用程序快捷方式
- 7. Android應用中的快捷方式
- 8. 如何在android中以編程方式添加應用程序快捷方式
- 9. android快捷方式,可以快捷方式intent額外包含應用程序對象嗎?
- 10. Chrome應用程序快捷方式/ Mozilla Prism安裝程序
- 11. C#VS卸載程序2010-應用程序快捷方式
- 12. Chrome應用程序模式 - 禁用快捷方式
- 13. vim - 我如何設置快捷方式?
- 14. Android的快捷方式
- 15. 使用Process.Start通過快捷方式運行應用程序C#
- 16. 嘗試重新安裝應用程序的應用程序快捷方式
- 17. C#程序集 - 快捷方式
- 18. 執行程序快捷方式
- 19. Windows安裝程序/ RunAs快捷方式
- 20. 如何重新創建webstart應用程序的快捷方式?
- 21. 在模擬器上模擬應用程序快捷方式
- 22. 更正Web應用程序的鍵盤快捷方式
- 23. 在Eclipse中添加應用程序啓動快捷方式?
- 24. 桌面快捷方式圖標覆蓋應用程序圖標
- 25. 添加快捷方式到應用程序的菜單
- 26. 爲Node Webkit應用程序創建桌面快捷方式
- 27. 如何創建Java桌面應用程序的快捷方式?
- 28. 爲應用程序創建快捷方式短語
- 29. iOS:應用程序主頁按鈕快捷方式
- 30. 在目錄中創建應用程序快捷方式