Android: Can I enable/disable an activity's intent filter programmatically?
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.
Disable ContentProvider by default and enable it programatically when needed
Thanks to Mike for figuring out the issue i was actually using COMPONENT_ENABLED_STATE_DISABLED
and this should have been COMPONENT_ENABLED_STATE_ENABLED
instead.
How to set broadcast receiver attributes programmatically?
You don't need to declare the BroadcastReceiver
in the manifest if you are registering/unregistering programmatically. You only need to declare BroadcastReceiver
s in the manifest if you want them to be instantiated from external triggers (for example, on device boot, or from the Alarm Manager, etc.)
Related Topics
Using the New "Manifestmerger" Property in Android
Android Studio- "Sdk Tools Directory Is Missing"
Setsupportactionbar Toolbar Cannot Be Applied to (Android.Widget.Toolbar) Error
Issues with Android Tabhost Example
Android Webview Anchor Link (Jump Link) Not Working
Create a Chat Bubble in Android
How to Set an Imageview's Image from a String
Using Webview Sethttpauthusernamepassword
Launching an Android Application from the Browser
Get Current Visible Text in Textview
Gradle Flavors for Android with Custom Source Sets - What Should the Gradle Files Look Like
Only One Log in Per User at the Time in Firebase for Android
How to Open Navigation Drawer with No Actionbar, Open with Just a Button
Android: Unicode/Charset Problems When Sending an Sms (Sendtextmessage)