Android-Filter-related

Source: Internet
Author: User

Let's look at a configuration between configurations, Androidmanifest.xml

<?xml version= "1.0" encoding= "Utf-8"?><manifest xmlns:android="Http://schemas.android.com/apk/res/android"  package ="Com.example.intent"android:versioncode="1"android:versionname ="1.0" >                <uses-sdkandroid:minsdkversion="8"android:targetsdkversion ="/>"                     <applicationandroid:allowbackup="true"android:icon="@drawable/ Ic_launcher "android:label=" @string/app_name "android:theme=" @style/apptheme " >                                        <activityandroid:name=". Mainactivity "android:label=" @string/app_name " >                                    <intent-filter>                <action android:name="Android.intent.action.MAIN" />                <category android:name="Android.intent.category.LAUNCHER" />            </intent-filter>        </activity>        <activityandroid:name=". Bmainactivity "android:exported=" false "android:label=" @string/title_ Activity_bmain " >                                                <intent-filter>                <category android:name="Android.intent.category.DEFAULT" />                <action android:name="com.example.intent.BMainActivity" />            </intent-filter>        </activity>        <activityandroid:name=". BMainActivity1 "android:label=" @string/title_activity_bmain_activity1 " >                                    <intent-filter >                <category android:name="Android.intent.category.DEFAULT"/>                <action android:name="com.example.intent.BMainActivity" />            </intent-filter>        </activity>    </Application></manifest>

After reading the previous blog post http://blog.csdn.net/gaopeng0071/article/details/45077203, you will find here that the implicit intent is not configured to have a problem ah, you look at 41 lines with 32 lines of Android: Name configuration same ay ~ ~, yes is the same, then we will take a look at the same android:name jump different activity, what will it look like, we run the next program,.

See the picture, Android platform for us to pop the window 2 activity, let us go to choose which one to jump. Hey, that's the right thing to do.

So if we want to specify in the background what to do, without modifying the Android:name, this introduces data to match (similar to a regular expression match).
,

When we click to jump again, we will jump to the activity that matches the rule by default.

Data usage

<data android:host="string"      android:mimeType="string"      android:path="string"      android:pathPattern="string"      android:pathPrefix="string"      android:port="string"      android:scheme="string" />

API description

Adds a data specification to an intent filter. The specification can be just a data type (the MimeType attribute), just a URI, or both a data type and a URI. A URI is specified by separate attributes for each of its parts:
Scheme://host:port/path or Pathprefix or Pathpattern
These attributes was optional, but also mutually dependent:if a scheme was not specified for the intent filter, all the OT Her URI attributes is ignored. If A host is not an specified for the filter, the port attribute and all of the path attributes are ignored.

See the Android API for more details

Android-Filter-related

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.