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

     

  • 相关阅读:
    ajax标准写法
    javascript序列化表单追加参数
    javascript获取url参数的方式
    jmeter实现跨线程组传递参数
    代码扫描工具SonarQube+Scanner的基本安装与应用
    给定一个非空正整数的数组,把数值与出现的次数存在一个新的字典中,并按照出现的次数排序
    定义一个函数,实现整数列表中偶数在左边,奇数在右边(不借助其它列表)
    python-leetcode1在一个整数数组中找出两数之和等于目标值,并把两数下标存在list中返回
    python根据key对字典进行排序
    python实现对浮点型的四舍五入
  • 原文地址:https://www.cnblogs.com/bobodeboke/p/3179576.html
Copyright © 2011-2022 走看看