Implicit Intent Intent

Source: Internet
Author: User

/Explicit Intent: You must specify the full package name and class name of the component to be activated (the application is coupled together)
When you normally activate your application's components, you use the

Implicit intent: You only need to specify the actions and data you want (there is no coupling between the benefits of the application)
Activate the app's implicit intent, without caring for the package name and class name of the other person.

1.Manifest

<activity android:name= "com.itheima.intent2.SecondActivity" ><intent-filter><action android:name= " Com.itheima.intent2.open2 "/><!--behavior (dozen)--><category android:name=" Android.intent.category.DEFAULT "/ ><data android:mimetype= "Application/person"/><!--data type (soy sauce)--><data android:scheme= "Jianren"/ ><!--type constraint, description--
</intent-filter> </activity>

Play action
Human data
Data category categories for attachments

It's okay, soy sauce.

2.intent.setaction ("Com.itheima.intent2.open2")//action (HIT)

3.intent.addcategory (Intent.category_default);//additional information, usually intent.category_default (in case of Nothing)

4.//URL: Uniform Resource Locator HTTP HTTPS FTP Rtsp:uri: Uniform Resource Identifier URL is a subset of URIs

Intent.setdata (Uri.parse ("Jianren: Zhang San"));
Intent.settype ("Application/person");
Intent.setdataandtype (Uri.parse ("Jianren: Zhang San"), "Application/person"); //data (soy sauce)

StartActivity (intent);//This method executes, clears the data for Settype () and therefore uses Setdataandtype

Implicit Intent Intent

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.