Android communication bridge Intent

Source: Internet
Author: User

Although relatively simple, I 'd like to mention the main content.

 

Use of Intent

IntentYou can start an Activity., You can also start a service,You can also initiate a broadcast.

Activity startActivity (), startActivityForResult ();

Service startService (), bindService ()

BroadCast sendBroadcast (), sendOrderedBroadcast (), sendStickyBroadcast ();

 

IntentActionAttribute

Implicitly specified:

For example, declare in AActivity,

My_Action = "com. king. android. my_action ";

Intent intent = new Intent ();

Intent. setAction (My_Action );

 

Note:

BActiivty accept:

Intent intent = getAction ();

String action =-intent. getAction ();

 

AndroidMainFest. xml file

<Activity android: name = ". BActivity"

Android: label = "@ string/app_name">

<Intent-filter>

<Action android: name = "com. king. android. my_action"/> specify the conditions for consideration.

<Category android: name = "android. intent. category. LAUNCHER"/>

</Intent-filter>

</Activity>

 

Access System Action attributes,

Data Attribute of Intent

The Category attribute of Intent:

For example, CATEGORY_LAUNCHER, the application appears at the top, and CATEGORY_HOME returns to the home interface.

Although the Extras attribute of Intent is simple, it is important,

 

There are many standard system Activity actions. You can check them online.

 

Note the Intent Policy

1. Action

2. Category

3. Data

 

 

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.