We already know that <intent-filter> is used to define how your activity is enabled by another activity. This is the so-called "filter ". However, if two activities have the same <intent-filter>, what will happen?
In androidmanifest. XMLCode.
[Java] View plaincopy
-
- <? 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>
If you use startactivity () to start the activity, the android system will pop up a window for selecting the activity.
Analysis:
To clear the "default activity" information, go to settings-> Applications-> Manage applications page, select the application usingintent, slide the view to the bottom, and click the CEAR ults button.