Intent. Action for Android Development
1 Intent. ACTION_MAIN
String: android. intent. action. MAIN
Identifies Activity as the beginning of a program. It is commonly used.
Input: nothing
Output: nothing
2 Intent. Action_CALL
Stirng: android. intent. action. CALL
Call the specified phone number.
Input: phone number. Data format: tel: + phone number
Output: Nothing
Intent intent = new Intent ();
Intent. setAction (Intent. ACTION_CALL );
Intent. setData (Uri. parse (tel: 1320010001 );
StartActivity (intent );
3 Intent. Action. DIAL
String: action. intent. action. DIAL
Call dial-up panel
Intent intent = new Intent (); intent. setAction (Intent. ACTION_DIAL); // android. intent. action. DIAL
Intent. setData (Uri. parse (tel: 1320010001 );
StartActivity (intent );
Input: phone number. Data format: tel: + phone number
Output: Nothing
Note: Open the dialing UI of Android. If no data is set, an empty UI is opened. If data is set, action. DIAL calls getData () to obtain the phone number.
However, the data format of the phone number is tel: + phone number.
4 Intent. Action. ALL_APPS
String: andriod. intent. action. ALL_APPS
List all applications.
Input: Nothing.
Output: Nothing.
5 Intent. ACTION_ANSWER
Stirng: android. intent. action. ANSWER
Handle incoming calls.
Input: Nothing.
Output: Nothing.
6 Intent. ACTION_ATTACH_DATA
String: android. action. ATTCH_DATA
Do not specify that some data should be attached to other places. For example, image data should be attached to contacts.
Input: Data
Output: nothing
7 Intent. ACTION_BUG_REPORT
String: android. intent. action. BUG_REPORT
Display Dug reports.
Input: nothing
Output: nothing
8 Intent. Action_CALL_BUTTON
String: android. action. intent. CALL_BUTTON.
The user presses the "dial" key. The test shows "call history"
Input: nothing
Output: nothing
Intent intent = new Intent (Intent. ACTION_CALL_BUTTON); startActivity (intent );
9 Intent. ACTION_CHOOSER
String: android. intent. action. CHOOSER
Display an activity selector that allows users to select what they want before the process, corresponding to Intent. ACTION_GET_CONTENT.
10. Intent. ACTION_GET_CONTENT
String: android. intent. action. GET_CONTENT
Allow users to select special types of data and return (special types of data: Take a photo or record a piece of audio)
Input: Type
Output: URI
Intrequestcode = 1001; Intent intent = new Intent (Intent. ACTION_GET_CONTENT); // android. intent. action. GET_CONTENT
Intent. setType (image/*); // view type. If it is another type, replace it with video/* or */*
Intent wrapperIntent = Intent. createChooser (intent, null );
StartActivityForResult (wrapperIntent, requestCode );
11 Intent. ACTION_VIEW
String android. intent. action. VIEW
Displays user data.
Generally, the corresponding Activity is opened based on the user's data type.
For example, tel: 13400010001 open the dialup program, the http://www.g.cn will open the browser and so on.
Uri uri = Uri. parse (http://www.google.com); // browser Uri uri = Uri. parse (tel: 1232333); // dialer
Uri uri = Uri. parse (geo: 39.899533, 116.036476); // open the map to locate
Intent it = new Intent (Intent. ACTION_VIEW, uri );
StartActivity (it );
// Play the video
Intent intent = new Intent (Intent. ACTION_VIEW );
Uri uri = Uri. parse (file: // sdcard/media.mp4 );
Intent. setDataAndType (uri, video /*);
StartActivity (intent );
// Call the SMS sending program
Intent it = new Intent (Intent. ACTION_VIEW );
It. putExtra (sms_body, information content ...);
It. setType (vnd. android-dir/mms-sms );
StartActivity (it );
12 Intent. ACTION_SENDTO
String: android. intent. action. SENDTO Description: send Short Messages
// Send the short message Uri = uri. parse (smsto: 13200100001 );
Intent it = new Intent (Intent. ACTION_SENDTO, uri );
It. putExtra (sms_body, information content ...);
StartActivity (it );
// Send mms. The device will prompt you to select a suitable program to send Uri uri = Uri. parse (content: // media/external/images/media/23 );
// Resources in the device (images or other resources)
Intent intent = new Intent (Intent. ACTION_SEND );
Intent. putExtra (sms_body, content );
Intent. putExtra (Intent. EXTRA_STREAM, uri );
Intent. setType (image/png );
StartActivity (it );
// Email Intent intent = new Intent (Intent. ACTION_SEND );
String [] tos = {android1@163.com };
String [] ccs = {you@yahoo.com };
Intent. putExtra (Intent. EXTRA_EMAIL, tos );
Intent. putExtra (Intent. EXTRA_CC, ccs );
Intent. putExtra (Intent. EXTRA_TEXT, The email body text );
Intent. putExtra (Intent. EXTRA_SUBJECT, The email subject text );
Intent. setType (message/rfc822 );
StartActivity (Intent. createChooser (intent, Choose Email Client ));
13 Intent. ACTION_GET_CONTENT
// Select the ID returned by the image requestCode
Intent intent = new Intent (Intent. ACTION_GET_CONTENT); // android. intent. action. GET_CONTENT
Intent. setType (contentType); // view type String IMAGE_UNSPECIFIED = image /*;
Intent wrapperIntent = Intent. createChooser (intent, null );
(Activity) context). startActivityForResult (wrapperIntent, requestCode );
// Add audio
Intent intent = new Intent (Intent. ACTION_GET_CONTENT );
Intent. setType (contentType); // String VIDEO_UNSPECIFIED = video /*;
Intent wrapperIntent = Intent. createChooser (intent, null );
(Activity) context). startActivityForResult (wrapperIntent, requestCode );
// Video shooting
Int durationLimit = getVideoCaptureDurationLimit (); // SystemProperties. getInt (ro. media. enc. lprof. duration, 60 );
Intent intent = new Intent (MediaStore. ACTION_VIDEO_CAPTURE); www.bkjia.com
Intent. putExtra (MediaStore. EXTRA_VIDEO_QUALITY, 0 );
Intent. putExtra (MediaStore. EXTRA_SIZE_LIMIT, sizeLimit );
Intent. putExtra (MediaStore. EXTRA_DURATION_LIMIT, durationLimit );
StartActivityForResult (intent, REQUEST_CODE_TAKE_VIDEO );
// Video
Intent intent = new Intent (Intent. ACTION_GET_CONTENT );
Intent. setType (contentType); // String VIDEO_UNSPECIFIED = video /*;
Intent wrapperIntent = Intent. createChooser (intent, null );
(Activity) context). startActivityForResult (wrapperIntent, requestCode );
// Recording
Intent intent = new Intent (Intent. ACTION_GET_CONTENT );
Intent. setType (ContentType. AUDIO_AMR); // String AUDIO_AMR = audio/amr;
Intent. setClassName (com. android. soundrecorder,
Com. android. soundrecorder. SoundRecorder );
(Activity) context). startActivityForResult (intent, requestCode );
// Photograph REQUEST_CODE_TAKE_PICTURE as the returned identifier
Intent intent = new Intent (MediaStore. ACTION_IMAGE_CAPTURE); // android. media. action. IMAGE_CAPTURE;
Intent. putExtra (MediaStore. EXTRA_OUTPUT, Mms. ScrapSpace. CONTENT_URI); // output, Uri. parse (content: // mms/scrapSpace );
StartActivityForResult (intent, REQUEST_CODE_TAKE_PICTURE );