[英]hide application launcher icon
I have 3 Apps A , B , C and I want to Hide icons of A & B from launcher . 我有3个应用A,B,C,我想从启动器中隐藏A和B的图标。 and I want to run A & B inside of C .
我想在C中运行A和B。
I Found this code for Hide apps : 我为隐藏应用找到了以下代码:
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(this, com.apps.MainActivity.class);
p.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
I found this cod for run app inside other apps : 我在其他应用程序中发现了此鳕鱼用于运行应用程序:
try {
PackageManager packageManager = getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage("ir.alexandre9009.nothing");
if (null != intent) {
startActivity(intent);
}
} catch (ActivityNotFoundException e) {
// default message
} catch (Exception e) {
// default message
}
Both codes work correctly 两种代码都能正常工作
But when I use both of them at the same time, they do not work. 但是当我同时使用它们时,它们将无法工作。 That is, when I hide the A and B software icons, they can no longer be implemented from within C software
也就是说,当我隐藏A和B软件图标时,它们将无法再从C软件中实现
I want to hide software A and B and run them from within the software C to launch their activity. 我想隐藏软件A和B并从软件C中运行它们以启动它们的活动。
Hide app's icon: 隐藏应用程序的图标:
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(this, your hiding app launcher class *com.A.MainActivity.class*);
p.setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLE,
PackageManager.DONT_KILL_APP);
Bring back app's icon: 带回应用程序的图标:
PackageManager p = getPackageManager();
ComponentName componentName = new ComponentName(this, your bring back app launcher class *com.A.MainActivity.class*);
p.setComponentEnabledSetting(componentName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.