Android Common Intent Action Rollup _android

Source: Internet
Author: User
Tags sqlite database

This article summarizes the common intent action features of Android. Share to everyone for your reference, specific as follows:

Android's basic design philosophy is to encourage the reduction of coupling between components, so Android provides intent (intent), intent provides a common messaging system that allows you to pass intent between your application and other applications to perform actions and generate events. Intent as a link between the various activity, its role is not only limited to simple data transmission. Through its own attributes, in fact, can easily complete a lot of more complex operations. This can be done by setting the intent property, for example, by calling the dialing function directly, processing receive text messages, and so forth.

Intent mainly has the following four important properties, they are:

The value of the Action:action property is a string that represents a series of commonly used actions that have been defined in the system. Set through the Setaction () method or in the manifest file androidmanifest.xml. The example code that identifies the activity to start for a program (Androidmanifest.xml) is as follows:

<span style= "FONT-SIZE:16PX;" >
<intent-filter>
  <action android:name= "Android.intent.action.MAIN"/>
  <category Android:name= "Android.intent.category.LAUNCHER"/>
</intent-filter>
</span>

Data:data is usually the operational data defined by the URI format. For example: tel://. Set by the SetData () method.
The Category:category property is used to specify the environment in which the current action (action) is executed. Set through the Addcategory () method or in the manifest file androidmanifest.xml. The default is: Category_default.
The Extras:extras property is primarily used to pass additional data required by the target component. Set by the Putextras () method.

In this article, we mainly introduce the use of common action, the action describes the string of action names triggered by intent, and for broadcastintent, action refers to the actions that are broadcast. Theoretically the action can be any string, and the action string associated with the Android application is defined in the intent class as a static string constant. There are many types of action, such as inbound, outgoing calls, teachers to receive text messages in class, and so on, following the common system-related action to organize:

1. Intent.action_main

String:android.intent.action.MAIN
Identifies the activity as the beginning of a program.

2. Intent.action_call

Stirng:android.intent.action.CALL

Call the specified phone number.

Intent intent=new Intent ();
Intent.setaction (Intent.action_call);
Intent.setdata (Uri.parse ("tel:10086");
StartActivity (Intent);

3. intent.action_power_connected;

Broadcast when plugged into external power

4 intent.action_power_disconnected;

Broadcast when disconnected from external power connection

5.intent.action.dial

String:action.intent.action.DIAL

Call Dial Panel

Intent intent=new Intent ();
Intent.setaction (intent.action_dial);
Intent.setdata (Uri.parse ("tel:10086");
StartActivity (Intent);

6.intent.action.all_apps

String:andriod.intent.action.ALL_APPS

List all the applications.

7.intent.action_answer

Stirng:android.intent.action.ANSWER

Handle incoming calls.

8. Intent.action_bug_report

String:android.intent.action.BUG_REPORT

Displays the dug report.

9. Intent.action_call_button

String:android.action.intent.CALL_BUTTON.

is equivalent to pressing the "Dial" key.

Intent Intent = new Intent (Intent.action_call_button);
StartActivity (Intent);

Telephony.sms_received

String:android.provider.Telephony.SMS_RECEIVED

Action to receive SMS

<intent-filter>
  <action android:name= "Android.provider.Telephony.SMS_RECEIVED"/>
  <data android:host= "localhost"/>
</intent-filter>

Intent.action_get_content.

String:android.intent.action.GET_CONTENT

Allows the user to select a particular kind of data and return (special kind of data: take a photo or record a piece of sound)

Intent.action_battery_low;

String:android.intent.action.BATTERY_LOW

Indicates a low battery charge

Intent.action_send

String:android.intent.action.Send

Action to send mail

Intent.action_call_privileged

String:android.intent.action.CALL_PRIVILEGED

Invoke the Skype action

Intent Intent = newintent ("Android.intent.action.CALL_PRIVILEGED");
Intent.setclassname ("Com.skype.raider",
"Com.skype.raider.Main");
Intent.setdata (Uri.parse ("Tel:" + phone));
StartActivity (Intent);

Intent.action_close_system_dialogs

When the screen times out to lock the screen, when the user presses the power button, long press or short press (regardless of the pop-up box), the Android system will broadcast this action message

The above is a summary of the common action, the action is actually a lot, if you want to use the above not listed, Google can.

For more information on Android-related content readers can view the site: "The activity of Android programming skills Summary", "Android Resources Operating Skills Summary", "Android File Operating skills summary", " Android Operation SQLite Database skills Summary, "Android operation JSON format Data Skills summary", "Android Database Operation skills Summary", "Android programming development of SD card Operation Summary", "Android Development introduction and Advanced Course", The Android View view tips summary and the Android Control usage summary

I hope this article will help you with the Android program.

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.