zoukankan      html  css  js  c++  java
  • android api文档:intent阅读笔记

    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

     

  • 相关阅读:
    lvs持久连接及防火墙标记实现多端口绑定服务
    LVS负载均衡器DR模型的实现
    CentOS 6.5结合busybox完成自制Linux系统及远程登录和nginx安装测试
    CentOS 6.5下的lamp环境rsyslog+MySQL+loganalyzer实现日志集中分析管理
    centos中selinux功能及常用服务配置
    网站遭遇CC及DDOS攻击紧急处理方案
    centos6.5下系统编译定制iptables防火墙扩展layer7应用层访问控制功能及应用限制QQ2016上网
    centos 6.5内核编译步骤及配置详解
    centos系统初始化流程及实现系统裁剪
    iptables实现网络防火墙及地址转换
  • 原文地址:https://www.cnblogs.com/bobodeboke/p/3179576.html
Copyright © 2011-2022 走看看