开发者

How to add or remove intent filter programmatically in android?

Is it possible to remove intent fi开发者_运维百科lters from activity based on user preference? Say dial intent filter is added and then at later point of time user decides the application should not handle dial.

Edit: Removed add part in question description


No, it seems they are static.

An intent filter is an instance of the IntentFilter class. However, since the Android system must know about the capabilities of a component before it can launch that component, intent filters are generally not set up in Java code, but in the application's manifest file (AndroidManifest.xml) as elements.

Source: http://developer.android.com/guide/topics/intents/intents-filters.html#ifs


I thought maybe you could enable/disable via the Package manager, but despite have a GET_INTENT_FILTERS flag in the PackageManager, it seems it's not supported.

The defect has been raised here, and discussion here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜