Intent 过滤器
Intent 对象可以显式指定目标组件.一旦显式指定了目标组件,Android 操作系统直接根据指定的目标组件名在AndroidManifest.xml文件中查找该组件声明,找到之后立即激活该组件。如果Intent 对象没有显式指定目标组件, Android 操作系统必须从AndroidManifest.xml文件中的所有intent过滤器中定位到一个最佳匹配的intent声明. 匹配过程事实上是把该 Intent 对象与 intent filters 中定义的intent元素做比对,一旦比对成功,Intent 过滤器立即通知Android 操作系统该过滤器所归属的组件可以响应该intent对象的操作请求,下面是是两个过滤器元素的相关定义:
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png"
android:label="@string/freneticLabel"
. . . >
<intent-filter . . . >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter . . . >
<action android:name="com.example.project.BOUNCE" />
<data android:mimeType="image/jpeg" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
. . .
</application>
</manifest>
第一个过滤器元素 — 包含 action 属性= "android.intent.action.MAIN" 和category 属性= "android.intent.category.LAUNCHER" — 这两个属性定义表示的含义是. 该 activity 应该显示在application 发射台上,用户可以在发射台上启动该应用 . 换句话说该 activity 是该应用程序的启动入口。
第二个过滤器元素同样包含了一个action属性,属性值是自定义的,表示该 activity 可以处理特定类型的数据.
AndroidManifest.xml文件中的组件元素可以有任意个intent filters,每个过滤器都声明了该组件的一种不同的能力. 如果一个组件没有定义过滤器元素,那么该组件只能被显式定义了组件名的intent对象激活。
For a broadcast receiver that's created and registered in code, the intent filter is instantiated directly as an IntentFilter object. All other filters are set up in the manifest.
For more on intent filters, see a separate document, Intents and Intent Filters.
Intent 对象可以显式指定目标组件.一旦显式指定了目标组件,Android 操作系统直接根据指定的目标组件名在AndroidManifest.xml文件中查找该组件声明,找到之后立即激活该组件。如果Intent 对象没有显式指定目标组件, Android 操作系统必须从AndroidManifest.xml文件中的所有intent过滤器中定位到一个最佳匹配的intent声明. 匹配过程事实上是把该 Intent 对象与 intent filters 中定义的intent元素做比对,一旦比对成功,Intent 过滤器立即通知Android 操作系统该过滤器所归属的组件可以响应该intent对象的操作请求,下面是是两个过滤器元素的相关定义:
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png"
android:label="@string/freneticLabel"
. . . >
<intent-filter . . . >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter . . . >
<action android:name="com.example.project.BOUNCE" />
<data android:mimeType="image/jpeg" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
. . .
</application>
</manifest>
第一个过滤器元素 — 包含 action 属性= "android.intent.action.MAIN" 和category 属性= "android.intent.category.LAUNCHER" — 这两个属性定义表示的含义是. 该 activity 应该显示在application 发射台上,用户可以在发射台上启动该应用 . 换句话说该 activity 是该应用程序的启动入口。
第二个过滤器元素同样包含了一个action属性,属性值是自定义的,表示该 activity 可以处理特定类型的数据.
AndroidManifest.xml文件中的组件元素可以有任意个intent filters,每个过滤器都声明了该组件的一种不同的能力. 如果一个组件没有定义过滤器元素,那么该组件只能被显式定义了组件名的intent对象激活。
For a broadcast receiver that's created and registered in code, the intent filter is instantiated directly as an IntentFilter object. All other filters are set up in the manifest.
For more on intent filters, see a separate document, Intents and Intent Filters.
发表评论
-
Intents and Intent Filters--Intent filters
2010-09-03 10:21 1364Intent filters To inform ... -
Intents and Intent Filters---Intent Resolution
2010-09-03 09:45 1197Intent Resolution Intents 可以分成 ... -
Intents and Intent Filters---Intent Objects
2010-09-02 11:15 818Intent Objects An Intent ... -
Intents and Intent Filters---序言
2010-09-01 16:06 874Intents and Intent Filters Key ... -
Application Fundamentals--Processes and lifecycles(进程生命周期)
2010-08-30 09:23 754Processes and lifecycles---进 ... -
Application Fundamentals--Broadcast receiver lifecycle(广播接收组件生命周期)
2010-08-30 09:20 4243Broadcast receiver lifecycle--- ... -
Application Fundamentals--Service lifecycle(服务组件的生命周期)
2010-08-30 09:18 1051Service lifecycle--服务组件的生命周期 A ... -
Application Fundamentals--Coordinating activities(activity实例间协调)
2010-08-30 09:15 966Coordinating activities---activ ... -
Application Fundamentals--Saving activity state(保存activity实例的状态信息)
2010-08-27 10:06 1258Saving activity state--保存activi ... -
Application Fundamentals--Component Lifecycles(组件生命周期)
2010-08-27 09:56 961Component Lifecycles--组件生命周期 A ... -
Application Fundamentals--Thread-safe methods(线程安全方法)
2010-08-27 09:51 1254Thread-safe methods--线程安 ... -
Application Fundamentals--Remote procedure calls(远程过程调用)
2010-08-27 09:41 1292Remote procedure calls--远程过程调用 ... -
Application Fundamentals--Processes and Threads(进程与线程)
2010-08-27 09:36 990Processes and Threads--进程 ... -
Application Fundamentals--Starting tasks
2010-08-27 09:34 701Starting tasks An activity is ... -
Application Fundamentals--Clearing the stack(堆栈清理)
2010-08-27 09:28 1345Clearing the stack--堆栈清理 If th ... -
Application Fundamentals--Launch modes-启动模式
2010-08-27 09:27 1118Launch modes-启动模式 There are fo ... -
Application Fundamentals--Affinities and new tasks
2010-08-27 08:45 979Affinities and new tasks By de ... -
Application Fundamentals--Activities and Tasks
2010-08-27 08:42 789Activities and Tasks As noted ... -
Application Fundamentals--The manifest file
2010-08-27 08:40 788The manifest file Android启动应用程 ... -
Application Fundamentals--Activating components: intents(组件的激活)
2010-08-27 08:38 934Activating components: intents- ...
相关推荐
DB2 9 Database and Application Fundamentals - Academic Initiative 000-302 2011年12月版本 V8.02 Q188道。
fundamentals-of-power-electronics_2nd_erickson_full
Fundamentals-of-HVAC-Control-Systems-Malestrom.part02.rar
linux-shell-scripting-fundamentals-bash.epub
Fundamentals-of-heat-and-mass-transfer 7ed.pdf ;INSTRUCTOR'S SOLUTIONS MANUAL
fundamentals-of-radar-signal
ios-12-programming-fundamentals-swift epub. very good
fundamentals-of-statistical-signal-processing-volume-i-estimation-theory_1
此存储库包含
2016-fuel cell fundamentals-3rd edition.pdf
Az-900-Microsoft-Azure-Fundamentals-Version-16.0-It-Exam-Practice-Test.pdf
Az-900-Microsoft-Azure-Fundamentals-Version-19.1-It-Exam-Practice-Test.pdf
Data Warehousing Fundamentals-2001
Electric Machinery Fundamentals - 5th Ed
安卓应用开发教程配套实验教程!课程网址:https://developer.android.com/courses/fundamentals-training/toc-v2
ruby-oo-fundamentals-attribute-accessors-lab-wdc01-seng-ft-060120-源码.rar
ruby-oo-fundamentals-attribute-accessors-lab-sea01-seng-ft-071320-master.rar
Kubernetes 基础课程个人笔记整理包含内容:01.课程介绍 02. KUBERNETES的基础 03.安装与配置 04. KUBERNETES 架构 05. API和访问(ACCESS) 06. API对象(API Objects) 07.通过部署管理状态(managing state with ...
vuejs-components-fundamentals-源码.rar