Intents and Intent Filters

作用: 1.start an activity 2.start a service 3.deliver a broadcast 有2种类型的Intents 1.explicit 显示 :明确指定要启动哪个activity 2.implicit 隐式 :并不指明启动哪个activity或application,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 系统查找所有声明的app 例如点击查看图片,系统会搜索所有可查看图片的应用,然后提供选择。 创建 Intents 1.Component name 有则是explicit ,无则是explicit 2.Action 确认具体要实施的动作,ACTION_VIEW ACTION_SEND 3.Data 具体数据 4.Category A string containing additional information about the kind of component that should handle the intent. CATEGORY_BROWSABLEThe target activity allows itself to be started by a web browser to display data referenced by a link—such as an image or an e-mail message. CATEGORY_LAUNCHERThe activity is the initial activity of a task and is listed in the system's application launcher. 5.Extras 附加数据,key-value.

posted on 2014-02-10 11:11  小白说我是2B  阅读(151)  评论(0编辑  收藏  举报

导航