• Intent七大属性之总结 分类: H1_ANDROID 2013-11-10 09:41 1074人阅读 评论(0) 收藏



    参考《疯狂android讲义》第5章


    1、Intent 用于封装程序的”调用意图“,不管想启动一个Acitivity、Service还是BroadcastReceiver,Android均使用统一的Intent对象来封装这种”启动意图“。很明显使用Intent提供了一致的编程模型。


    2、Intent还有一个好处,如果应用程序只是想启动具有某种特征的组件,并不想和某个具体的组件耦合,则可以通过在intent-filter中配置相应的属性进行处理,与stucts2中的MVC框架思路类似。


    3、Intent对象大致包括7大属性:ComponentName  Action  Category  Data  Type  Extra  Flag。


    4、7大属性中,前面5个均用于指定本intent用于启动哪个组件,ComponentName直接指定组件的名称,后4个指定类型,只要符合此类型条件的组件均可响应此Intnet。前者称为显式Intnet,后者称为隐式intent。前者一般用于启动自身程序的其它组件,后者一用于启动其它程序的组件(包括系统组件)。

    • Explicit intents designate the target component by its name (the component name field, mentioned earlier, has a value set). Since component names would generally not be known to developers of other applications, explicit intents are typically used for application-internal messages — such as an activity startinga subordinate service or launching a sister activity.
    • Implicit intents do not name a target (the field for the component name is blank). Implicit intents are often used to activate componentsin other applications.



    说见Intent七大属性之一~~~七

    版权声明:本文为博主原创文章,未经博主允许不得转载。

    欢迎转载,请注明来自: www.lujinhong.com www.cnblogs.com/lujinhong2
  • 相关阅读:
    [leedcode 82] Remove Duplicates from Sorted List II
    [leedcode 83] Remove Duplicates from Sorted List
    [leedcode 81] Search in Rotated Sorted Array II
    [leedcode 80] Remove Duplicates from Sorted Array II
    [leedcode 79] Word Search
    2018 ICPC青岛-books(思维题)
    CodeForces 15A-Cottage Village(思维题)
    CodeForces 755A-PolandBall and Hypothesis(思维题)
    CodeForces
    UVA11624-Fire!(BFS)
  • 原文地址:https://www.cnblogs.com/lujinhong2/p/4637365.html
Copyright © 2020-2023  润新知