intent是几大组件之间进行通信的组件。可以包含以下几个部分:

component:指明了处理该intent的对象。

Action类似于一个函数名,规定了其他部分的对应用法:

The action largely determines how the rest of the intent is structured — particularly the data and extras fields — much as a method name determines a set of arguments and a return value.

Data就是一个Uri:

In many cases, the data type can be inferred from the URI — particularly content: URIs, which indicate that the data is located on the device and controlled by a content provider Category:一个字符串: A string containing additional information about the kind of component that should handle the intent. Any number of category descriptions can be placed in an Intent object.

category:一个字符串

A string containing additional information about the kind of component that should handle the intent. Any number of category descriptions can be placed in an Intent object.

Extras: 是一组键值对:

Key-value pairs for additional information that should be delivered to the component handling the intent. Just as some actions are paired with particular kinds of data URIs, some are paired with particular extras. . These methods parallel those for Bundle objects

Flags一些常数字

Flags of various sorts. Many instruct the Android system how to launch an activity (for example, which task the activity should belong to) and how to treat it after it's launched (for example, whether it belongs in the list of recent activities).

不过以上这些组件在解析对应的intent时候,

Only three aspects of an Intent object are consulted when the object is tested against an intent filter:

action data (both URI and data type) category

The extras and flags play no part in resolving which component receives an intent.

与之对应的intentFilter,

A filter has fields that parallel the action, data, and category fields of an Intent object. An implicit intent is tested against the filter in all three areas. To be delivered to the component that owns the filter, it must pass all three tests.

(至于intent和intent filter详细的匹配规则可以参照具体的api文档,尤其是关于data的匹配规则相对复杂:

Since most available data is dispensed by content providers, filters that specify a data type but not a URI are perhaps the most common

更多相关文章

  1. ViewPage的使用配合我们的PagerTabStrip
  2. Android用StaticLayout实现文字转化为图片效果(类似长微博发送)
  3. Android(安卓)四大组件之 Activity(二)
  4. Android学习笔记——常用的基本UI组件及其常用属性值和相关方法
  5. Android(安卓)JNI 基础知识
  6. Android组件——使用DrawerLayout仿网易新闻v4.4侧滑菜单
  7. android xml文件中进行上传图片以及获取图片
  8. 01-android快速入门
  9. Unable to start activity异常的解决方案

随机推荐

  1. Android(安卓)popupwindow以及windowMana
  2. Android的版本(Version)和API-level的对应
  3. android平台解析epub格式的书籍信息
  4. eclipse导入android的app
  5. android QRCode
  6. Android 加密解密字符串
  7. 烽火学习笔记1
  8. 封装Android的AsyncHttpClient请求工具
  9. android 获取系统电量
  10. 【黑科技】钉钉自动打卡