Reputation: 162
So I have one app that displays multiple activities in the Launcher using
<category android:name="android.intent.category.LAUNCHER"/>
I want to know how to programmatically toggle this on/off, I will be needing to do so based on some data I will be receiving. Is this possible? If so, how can it be done.
Upvotes: 1
Views: 1018
Reputation: 1006674
You can call setComponentEnabledSetting()
on PackageManager
to enable and disable the activity. Well-written home screen implementations will remove the launcher icon when you disable the activity with the LAUNCHER
category.
However, bear in mind that some home screen implementations will cache the information that they obtain from PackageManager
and therefore may continue to show the icon, until they refresh their contents. There is nothing much that you can do about this.
Upvotes: 4