What are intent-filters in Android?

后端 未结 10 2246
渐次进展
渐次进展 2020-12-01 02:34

In my android app, I wanted to start an activity \'B\' from initial activity \'A\'. I have created classes for both of these. However when using following code to start B, I

10条回答
  •  醉酒成梦
    2020-12-01 03:27

    When you create an implicit intent, the Android system finds the appropriate component to start by comparing the contents of the intent to the intent filters declared in the manifest file of other apps on the device. If the intent matches an intent filter, the system starts that component and delivers it the Intent object. If multiple intent filters are compatible, the system displays a dialog so the user can pick which app to use.

    An intent filter is an expression in an app's manifest file that specifies the type of intents that the component would like to receive. For instance, by declaring an intent filter for an activity, you make it possible for other apps to directly start your activity with a certain kind of intent. Likewise, if you do not declare any intent filters for an activity, then it can be started only with an explicit intent.

    According: Intents and Intent Filters

提交回复
热议问题