Android: Can I enable/disable an activity's intent filter programmatically?

I need to hide or show my app's icon in the launcher depending on some runtime information. I'd like to still be able to run the activity by an explicit intent, so disabling the activity isn't a good option (I don't even know for sure if it will work, I haven't tried it yet, but I guess it will). So, can I disable an intent filter?


You can't do this directly, but you can create an activity alias in your AndroidManifest.xml with the intent filter in question, and then enable or disable the alias using PackageManager#setComponentEnabledSetting(), leaving your other intent filters in the main copy of the Activity so they won't be affected.

Need Your Help

gdb fails to run ELF 64-bit program with "File format not recognized"

c gcc debugging gdb

I'm trying to use GDB to debug (to find an annoying segfault). When I run:

ADB - Android - Getting the name of the current activity

android adb ddms

Is there a way to get the details of the current activity that is running via adb.