下载此文档

安卓组件通信与广播消息.pptx


文档分类:通信/电子 | 页数:约55页 举报非法文档有奖
1/55
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/55 下载此文档
文档列表 文档介绍
组件(zǔ jiàn)通信与广播消息
第一页,共55页。
本章(běn zhānɡ)学习内容
使用Intent进行组件通信的原理
使用Intent启动Activity的方法
获取Activity返回值的方法
Intent过滤器的原理与匹配机制
发送和接收广播(guǎngbō)消息的方法
第二页,共55页。
什么(shén me)是Intent
Android中一种消息传递机制,可以通过intent消息激活activity、service和broadcast receiver。在运行时绑定在同一应用或不同应用的组件。
每个intent本身是一个Intent类的对象,是对一个执行(zhíxíng)动作的抽象描述,包含了组件名(component name)、动作(action)、数据(data)、类型(category)、附加信息(extra)和标志(flags)信息。
应用A
应用B
某组件
某组件
发送Intent
系统
启动
发送(fā sònɡ)Intent
第三页,共55页。
组件(zǔ jiàn)名(component name)
接收intent的组件的名字。是目标组件的完整且有效的类名称(如“”)。
组件名是可选的。
如果设置,intent对象就发送给该类的实例;
如果没设置,Android会使用intent对象的其它信息去定位(dìngwèi)一个适合的目标。
第四页,共55页。
动作(dòngzuò)(action)
待执行的由字符串命名的动作。Intent类中定义(dìngyì)了许多action常量,包括这些:
第五页,共55页。
数据(shùjù)(data)
第六页,共55页。
URI(Uniform Resource Identifier)
标识抽象(chōuxiàng)和物理资源的字符串。
资源
标识形式多样:URL,URN
URI={URL,URN,……}
第七页,共55页。
URI语法(yǔfǎ)成分
<scheme>:<scheme-specific-part>
scheme :Just as there are many different methods of access to resources, there are a variety of schemes for identifying such resources. It defines the semantics for the remainder of the URI string.
第八页,共55页。
第九页,共55页。
Android中的URI
Each part of the URI: scheme://host:port/path
For example,
content://:200/folder/subfolder/etc
the scheme is "content", the host is "", the port is "200", and the path is "folder/subfolder/etc". The host and port together constitute the URI authority; if a host is not specified, the port is ignored.
Each of these attributes is optional, but they are not independent of each other: For an authority to be meaningful, a scheme must also be specified. For a path to be meaningful, both a scheme and an authority must be specified.
content://
第十页,共55页。

安卓组件通信与广播消息 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数55
  • 收藏数0 收藏
  • 顶次数0
  • 上传人892629196
  • 文件大小412 KB
  • 时间2021-11-12
最近更新