簡體   English   中英

如何從我的Android應用程序隱藏Android桌面上的其他應用程序快捷方式圖標

[英]How to hide other application Shortcut icons on android desktop from my android application

我正處於開發我的Android應用程序的最后階段,我剩下的就是用我的應用程序隱藏手機桌面上的所有其他應用程序圖標。 現在我在這里找到了這個代碼,我試圖修改它,甚至添加適當的權限,但似乎沒有得到所需的結果。 請幫我修改它或建議我如何修改它來做我想要的。 這是代碼

Intent myLauncherIntent = new Intent();
myLauncherIntent.setClassName("your.package.name", "YourLauncherActivityName");
myLauncherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, myLauncherIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Application Name");
intent.putExtra
   (
    Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
    Intent.ShortcutIconResource.fromContext
                                (
                                     getApplicationContext(), 
                                     R.drawable.app_icon
                                )
   );
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);

我很感激能得到的所有幫助。 干杯伙計們。

我剩下的就是用我的應用程序隱藏手機桌面上的所有其他應用程序圖標。

幸運的是,這是不可能的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM