zoukankan      html  css  js  c++  java
  • Intent七大属性之总结


    参考《疯狂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七大属性之一~~~七

  • 相关阅读:
    Java函数调用
    Java编程工具的介绍
    Java关键字及作用
    Java面向对象
    Java代码内容概述
    Java构造方法
    Java面向对象
    Java数组概述和定义
    JDBC工具类,基于C3P0的数据库连接池,提供获取连接池、获取连接对象、释放资源和封装事务操作的方法
    图片爬虫工具,可以爬取指定网页的图片
  • 原文地址:https://www.cnblogs.com/eaglegeek/p/4557966.html
Copyright © 2011-2022 走看看