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

     

  • 相关阅读:
    Linux 下没有 my.cnf 文件的解决方式,完全是我自己整的,好多教程都是瞎扯的 (zhuan)
    Virtualbox虚拟机安装CentOS6.5图文详细教程(zhuan)
    virtualbox中centos系统配置nat+host only上网(zhuan)
    VirtualBox的网络配置,Host Only+NAT方式 (zhuan)
    Linux上安装Mysql后除了本机其他机器不能访问的问题(zhuan)
    VirtualBox没有64位选项,无法安装64位的解决方法(zhuan)
    CentOS查看内核版本,位数,版本号 (zhuan)
    datagrid实现单行的选择、取消
    datagrid实现行的上移和下移
    Excel 、数据库 一言不合就转换 (zhuan)
  • 原文地址:https://www.cnblogs.com/bobodeboke/p/3179576.html
Copyright © 2011-2022 走看看