0

I have been trying to hide my app's icon from the app drawer and open it from dialler. The dialler part works perfertly, but i am having issues with hiding it. My problem is, if i hide my activity, it's get destroyed and i can no longer access it from my dialler. I have tried creating a duplicate activity as suggested here, but if i do that then my initial problem of hiding the icon is not solved.

Any ideas would be greatly appreciated.

Community
  • 1
  • 1
  • 1
    And **why** would you kike to do so? – Phantômaxx Jul 01 '15 at 07:48
  • @DerGolem It could be an app designed to run mainly in background, which the user would like to hide from his app drawer. Just to keep things clean. – Ealhad Jul 01 '15 at 08:03
  • In fact, I happen to have such an app installed, however it needs root access. – Ealhad Jul 01 '15 at 08:06
  • @Ealhad I want to do it dynamically only if the user decides to hide it. Here is the code is used to hide the app ' private void hideMainActivity() { PackageManager packageManager = getPackageManager(); ComponentName componentName = new ComponentName(this, LauncherActivity.class); packageManager.setComponentEnabledSetting( componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP ); }' – Vincent Kyalo Jul 01 '15 at 08:08

2 Answers2

0

I was doing it wrong. Just set the MainActivity as the launcher and set a duplicate activity in the dialler.

0

Please use this.

PackageManager pkg=this.getPackageManager(); pkg.setComponentEnabledSetting(new ComponentName(this,SplashActivity.class),PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);

Ismaran Duwadi
  • 1,529
  • 12
  • 10