开发者

Why custom intents in android

[UPDATE] rephrasing my question. Could anyone please advise, when and how should i make the decision of using a custom intent vs using android's default intents?

[ORIGINAL POST] A very very basic question. Could somebody explain in simple terms why do we create custom intents in android?

I went through many articles on intents and custom intent creation, and was mentioned android would scan list of intent filters for actions. i don't clearly understand this part.

My understanding and questions

  1. Intents - used as a message pasing framework that glues various components - ok understood
  2. used to start activities and services and listen to various ev开发者_C百科ents - ok understood :)

but by using a general Intent say ACTION_VIEW vs MY_CUSTOM_ACTION_VIEW - what exactly is the difference? When would we use one over the other? any example please.


Custom intents are pretty useful, in my experience. For instance, my audio app can receive custom PLAY, RECORD and PAUSE intents.

Custom intents make the framework extensible. It allows for innovation in regard to interaction between applications, be it apps from a single dev or third party.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜