Android 程式开发:(二)使用Intents链接Activities —— 2.2“过滤器”冲突
来源:互联网 发布:知柏地黄丸能治失眠吗 编辑:程序博客网 时间:2024/06/07 00:12
我们已经知道<intent-filter>用来定义你的Activity如何被另外的Activity开启,这就是所谓的“过滤器”。但是,如果有两个Activity有相同的<intent-filter>,那将发生什么呢?
AndroidManifest.xml中的代码。
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="net.horsttnann.UsingIntent"
- android:versionCode="1"
- android:versionName="1.0" >
- <uses-sdk android:minSdkVersion="14" />
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name" >
- <activity
- android:label="@string/app_name"
- android:name=".UsingIntentActivity" >
- <intent-filter >
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity
- android:label="Second Activity"
- android:name=".SecondActivity" >
- <intent-filter >
- <action android:name="net.horsttnann.SecondActivity" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
- <activity
- android:label="Third Activity"
- android:name=".ThirdActivity" >
- <intent-filter >
- <action android:name="net.horsttnann.SecondActivity" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
- </application>
- </manifest>
效果图:
提示:
如果想清除“默认选择”的Activity信息,可以去Settings->Applications->Manage applications界面,选择应用UsingIntent,将视图滑动到最底部,点击Cear Defaults按钮。
- Android 程式开发:(二)使用Intents链接Activities —— 2.2“过滤器”冲突
- Android 程式开发:(二)使用Intents链接Activities —— 2.1基本操作
- Android 程式开发:(二)使用Intents链接Activities —— 2.3返回结果
- 【Android 开发教程】链接Activities
- Android Intents和Intent过滤器(二)
- Android Intents和Intent过滤器(二)
- Android Intents和Intent过滤器(二)
- Android Intents和Intent过滤器(二)
- intents 和 intent 过滤器(二)
- 安卓学习140501:组件——Activities与Intents
- Android开发 之 Intents and Intent Filters(二)
- Android官方开发指南-意图和意图过滤器(Intents and Intent Filters)
- Android Intents和Intent过滤器
- Android:使用Intents进行共享(Share With Intents)
- Android 开发文档 程序基础——Activating components: intents
- Android 开发文档 程序基础——Activities and Tasks
- Android 程式开发:(四)使用Intent调用“内置”应用 —— 4.1范例
- Android 程式开发:(四)使用Intent调用“内置”应用 —— 4.2浅析Intent
- 基于 Android NDK 的学习之旅-----环境搭建
- Android Activity 中 onActivityResult() 与 setResult()的调用时机
- 亚星“天景”双巴为古都咸阳再添新“景”
- ActiveMQ实例
- csdn的大一第二学期笔记
- Android 程式开发:(二)使用Intents链接Activities —— 2.2“过滤器”冲突
- HTML使用样式的几种方式
- Packet capture on Firewalls (ASA/PIX/FWSM)
- C#实现office文档转换为PDF或xps的一些方法
- ActiveMQ基础入门
- 基于 Android NDK 的学习之旅-----Android.mk 介绍
- 计算机网络 --- 信道
- 鼠标有关JavaScript事件
- 这个稍微有点档次了:解析 STM32 的启动过程