Android的应用程序包含三种重要组件:Activity、Service、BroadcastReceiver,应用程序采用一致的方式来启动它们——都是依靠Intent来启动的,Intent就封装了程序想要启动程序的意图,不仅如此,Intent还可用于与被启动组件交换信息。

下图展示了使用Intent启动不同组件的方法。

组件类型 启动方法
Activity

startActivity(Intent intent)

startActivity(Intent intent,int requestCode)

Service

ComponentName startService(Intent service)

boolean bindService(Intent service,ServiceConnection conn,int flags)

BoradcastReceiver

sendBroadcast(Intent intent)

sendBroadcast(Intent intent,String receiverPermission)

sendOrderedBroadcast(Intent intent,String receiverPermission,BroadcastReceiver resultReceiver,Handler

scheduler,int initialCode,String initialData,Bundle initialExtras)

sendOrderedBroadcast(Intent intent,String receiverPermission)

sendStickyBroadcast(Intent intent)

sendStickyOrderedBroadcast(Intent intent,BroadcastReceiver resultReceiver,Handler scheduler,int initialCode,String initialData,Bundle initialExtras)

Intent对象大致包含Component、Action、Category、Data、Type、Extra和Flag这7种属性,其中Component用于明确指定需要启动的目标组件,而Extra则用于“携带”需要交换的数据。

Intent对象详解——使用Intent启动系统组件的更多相关文章

  1. Android总结篇——Intent机制详解及示例总结

         最近在进行android开发过程中,在将 Intent传递给调用的组件并完成组件的调用时遇到点困难,并且之前对Intent的学习也是一知半解,最近特意为此拿出一些时间,对Intent部分进行 ...

  2. Android零基础入门第80节:Intent 属性详解(下)

    上一期学习了Intent的前三个属性,本期接着学习其余四个属性,以及Android系统常用内置组件的启动. 四.Data和Type属性 Data属性通常用于向Action属性提供操作的数据.Data属 ...

  3. Intent知识详解

    Intent知识详解 一.什么是Intent 贴一个官方解释: An intent is an abstract description of an operation to be performed ...

  4. Android零基础入门第79节:Intent 属性详解(上)

    Android应用将会根据Intent来启动指定组件,至于到底启动哪个组件,则取决于Intent的各属性.本期将详细介绍Intent的各属性值,以及 Android如何根据不同属性值来启动相应的组件. ...

  5. Intent属性详解一 component属性

    先看效果图 概述 在介绍Component之前,我们首先来了解ComponentName这个类:ComponentName与Intent同位于android.content包下,我们从Android官 ...

  6. JavaWeb学习----JSP内置对象详解

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...

  7. ActiveXObject对象详解

    一.什么是 ActiveX 控件?         ActiveX 控件广泛用于 Internet.它们可以通过提供视频.动画内容等来增加浏览的乐趣.不过,这些程序可能出问题或者向您提供不需要的内容. ...

  8. mvc-servlet---ServletConfig与ServletContext对象详解(转载)

    ServletConfig与ServletContext对象详解 一.ServletConfig对象    在Servlet的配置文件中,可以使用一个或多个<init-param>标签为s ...

  9. jQuery的deferred对象详解

    jQuery的deferred对象详解请猛击下面的链接 http://www.ruanyifeng.com/blog/2011/08/a_detailed_explanation_of_jquery_ ...

随机推荐

  1. java.lang.RuntimeException: java.lang.NoSuchMethodException:

    [java] 15/12/19 14:09:46 INFO mapred.JobClient: Task Id : attempt_201512182036_0017_m_000000_0, Stat ...

  2. UESTC 1222 Sudoku

    爆搜即可 /* *********************************************** author : email :523689985@qq.com created tim ...

  3. HDU 3201 Build a Fence

    水题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> us ...

  4. MyEclipse10.7使用egit托管项目到GitHub

    原文出处:http://www.xuebuyuan.com/2126438.html 1.注册一个github账户:(www.github.com)点击打开链接 注册完成后,登录github后点击右上 ...

  5. Cow Hopscotch

    Cow Hopscotch 题目描述 Just like humans enjoy playing the game of Hopscotch, Farmer John's cows have inv ...

  6. 关于BOM 的详细介绍

    原文地址:http://blog.csdn.net/u011526599/article/details/51419182

  7. tls session resumption

    http://stackoverflow.com/questions/12318325/resume-tls-connection-in-java As long as you use the sam ...

  8. 手机web——自适应网页设计(html/css控制) - 51CTO.COM

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  9. 五、pig学习

    一.什么是pig 1.pig和sql.map-reduce的关系 来自为知笔记(Wiz)

  10. 51nod1119(除法取模)

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1119 题意:中文题诶- 思路:这题数据比较大直接暴力肯定是不 ...