Summary of common intent actions for Android

This article summarizes the intent action function commonly used in Android. Share with you for your reference, as follows:

The basic design concept of Android is to encourage the reduction of coupling between components. Therefore, Android provides intent. Intent provides a general message system, which allows the transmission of intent between your application and other applications to perform actions and generate events. As a link between activities, intent is not limited to simple data transmission. Through its own properties, it can easily complete many more complex operations. For example, directly calling the dial-up function, processing and receiving SMS, and so on can be completed by setting the intent property.

Intent mainly has the following four important attributes:

Action: the value of the action attribute is a string, which represents that a series of common actions have been defined in the system. Through the setaction () method or in the manifest file androidmanifest XML. The sample code identifying the activity as the beginning of a program (configured by androidmanifest. XML) is as follows:

Data: data is usually operation data defined in URI format. For example: Tel: / /. Set through the SetData () method. Category: the category property is used to specify the environment in which the current action is executed. Through the addcategory () method or in the manifest file androidmanifest XML. The default is category_ DEFAULT。 Extras: extras attribute is mainly used to transfer additional data required by the target component. Set through the putextras() method.

In this article, we mainly introduce the use of common actions. Action describes the string of the action name triggered by intent. For broadcastintent, action refers to the action broadcast. Theoretically, action can be any string, and action strings related to Android system applications are defined in the intent class in the form of static string constants. There are many kinds of actions, such as incoming and outgoing calls, teachers' acceptance of short messages in class, etc. here are some common actions related to the system:

1. Intent. ACTION_ MAIN

String: android. intent. action. Main identifies activity as the beginning of a program.

2. Intent. Action_ CALL

Stirng: android. intent. action. CALL

Call the specified phone number.

3. Intent. ACTION_ POWER_ CONNECTED;

Broadcast when external power is plugged in

4 Intent. ACTION_ POWER_ DISCONNECTED;

Broadcast when external power is disconnected

5.Intent. Action. DIAL

String: action. intent. action. DIAL

Call dial panel

6.Intent. Action. ALL_ APPS

String: andriod. intent. action. ALL_ APPS

List all apps.

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.

Equivalent to pressing the "dial" key.

10. Telephony. SMS_ RECEIVED

String: android. provider. Telephony. SMS_ RECEIVED

Action of receiving SMS

11. Intent. ACTION_ GET_ CONTENT

String: android. intent. action. GET_ CONTENT

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

12. Intent. ACTION_ BATTERY_ LOW;

String: android. intent. action. BATTERY_ LOW

Indicates that the battery is low

13. Intent. ACTION_ SEND

String: android. intent. action. Send

Action to send mail

14. Intent. ACTION_ CALL_ PRIVILEGED

String:android. intent. action. CALL_ PRIVILEGED

Call Skype's action

15. Intent. ACTION_ CLOSE_ SYstem_ DIALOGS

When the screen times out to lock the screen, the Android system will broadcast this action message when the user presses the power button, long press or short press (whether or not the dialog box jumps out) to lock the screen

The above is a summary of common actions. In fact, there are many actions. If you want to use those not listed above, just Google.

For more Android related content, readers who are interested can view the special topics of this site: activity operation skill summary of Android programming, Android resource operation skill summary, Android file operation skill summary, Android SQLite database operation skill summary, Android JSON format data operation skill summary, Android database operation skill summary Summary of SD card operation methods for Android programming development, introduction and advanced tutorial for Android development, summary of Android view skills and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>