1. Search for content from google
Intent intent = new Intent ();
Intent. setAction (Intent. ACTION_WEB_SEARCH );
Intent. putExtra (SearchManager. QUERY, "searchString ")
StartActivity (intent );
2. Browse the webpage
Uri uri = Uri. parse (http://www.google.com ");
Intent it = new Intent (Intent. ACTION_VIEW, uri );
StartActivity (it );
3. display a map
Uri uri = Uri. parse ("geo: 38.899533,-77.036476 ″);
Intent it = new Intent (Intent. Action_VIEW, uri );
StartActivity (it );
4. Route Planning
Uri uri = Uri. parse ("http://maps.google.com/maps ?" +
"F = dsaddr = startLat startLng & daddr = endLat endLng & hl = en ");
Intent it = new Intent (Intent. ACTION_VIEW, URI );
StartActivity (it );
5. Call
Uri uri = Uri. parse ("tel: xxxxxx ");
Intent it = new Intent (Intent. ACTION_DIAL, uri );
StartActivity (it );
You need to add the permission <uses-permission id = "android. permission. CALL_PHONE">
6. Call the SMS Program
Intent it = new Intent (Intent. ACTION_VIEW );
It. putExtra ("sms_body", "The SMS text ");
It. setType ("vnd. android-dir/mms-sms ");
StartActivity (it );
7. send SMS
Uri uri = Uri. parse ("smsto: 0800000123 ″);
Intent it = new Intent (Intent. ACTION_SENDTO, uri );
It. putExtra ("sms_body", "The SMS text ");
StartActivity (it );
String body = "this is sms demo ";
Intent mmsintent = new Intent (Intent. ACTION_SENDTO, Uri. fromParts ("smsto", number, null ));
Mmsintent. putExtra (Messaging. KEY_ACTION_SENDTO_MESSAGE_BODY, body );
Mmsintent. putExtra (Messaging. KEY_ACTION_SENDTO_COMPOSE_MODE, true );
Mmsintent. putExtra (Messaging. KEY_ACTION_SENDTO_EXIT_ON_SENT, true );
StartActivity (mmsintent );
8. Send MMS
Uri uri = Uri. parse ("content: // media/external/images/media/23 ″);
Intent it = new Intent (Intent. ACTION_SEND );
It. putExtra ("sms_body", "some text ");
It. putExtra (Intent. EXTRA_STREAM, uri );
It. setType ("image/png ");
StartActivity (it );
StringBuilder sb = new StringBuilder ();
Sb. append ("file ://");
Sb. append (fd. getAbsoluteFile ());
Intent intent = new Intent (Intent. ACTION_SENDTO, Uri. fromParts ("mmsto", number, null ));
// Below extra datas are all optional.
Intent. putExtra (Messaging. KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject );
Intent. putExtra (Messaging. KEY_ACTION_SENDTO_MESSAGE_BODY, body );
Intent. putExtra (Messaging. KEY_ACTION_SENDTO_CONTENT_URI, sb. toString ());
Intent. putExtra (Messaging. KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode );
Intent. putExtra (Messaging. KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent );
StartActivity (intent );
9. Send Email
Uri uri = Uri. parse ("mailto: xxx@abc.com ");
Intent it = new Intent (Intent. ACTION_SENDTO, uri );
StartActivity (it );
Intent it = new Intent (Intent. ACTION_SEND );
It. putExtra (Intent. EXTRA_EMAIL, "me@abc.com ");
It. putExtra (Intent. EXTRA_TEXT, "The email body text ");
It. setType ("text/plain ");
StartActivity (Intent. createChooser (it, "Choose Email Client "));
Intent it = new Intent (Intent. ACTION_SEND );
String [] tos = {"me@abc.com "};
String [] ccs = {"you@abc.com "};
It. putExtra (Intent. EXTRA_EMAIL, tos );
It. putExtra (Intent. EXTRA_CC, ccs );
It. putExtra (Intent. EXTRA_TEXT, "The email body text ");
It. putExtra (Intent. EXTRA_SUBJECT, "The email subject text ");
It. setType ("message/rfc822 ″);
StartActivity (Intent. createChooser (it, "Choose Email Client "));
Intent it = new Intent (Intent. ACTION_SEND );
It. putExtra (Intent. EXTRA_SUBJECT, "The email subject text ");
It. putExtra (Intent. EXTRA_STREAM, "file: // sdcard/mysong.mp3 ″);
SendIntent. setType ("audio/mp3 ″);
StartActivity (Intent. createChooser (it, "Choose Email Client "));
10. Play multimedia
Intent it = new Intent (Intent. ACTION_VIEW );
Uri uri = Uri. parse ("file: // sdcard/song.mp3 ″);
It. setDataAndType (uri, "audio/mp3 ″);
StartActivity (it );
Uri uri = Uri. withAppendedPath (MediaStore. Audio. Media. INTERNAL_CONTENT_URI, "1 ″);
Intent it = new Intent (Intent. ACTION_VIEW, uri );
StartActivity (it );
11. uninstall apk
Uri uri = Uri. fromParts ("package", strPackageName, null );
Intent it = new Intent (Intent. ACTION_DELETE, uri );
StartActivity (it );
12. install apk
Uri installUri = Uri. fromParts ("package", "xxx", null );
ReturnIt = new Intent (Intent. ACTION_PACKAGE_ADDED, installUri );
13. Open the camera
Intent I = new Intent (Intent. ACTION_CAMERA_BUTTON, null );
This. sendBroadcast (I );
Long dateTaken = System. currentTimeMillis ();
String name = createName (dateTaken) + pai.jpg ";
FileName = folder + name;
ContentValues values = new ContentValues ();
Values. put (Images. Media. TITLE, fileName );
Values. put ("_ data", fileName );
Values. put (Images. Media. PICASA_ID, fileName );
Values. put (Images. Media. DISPLAY_NAME, fileName );
Values. put (Images. Media. DESCRIPTION, fileName );
Values. put (Images. ImageColumns. BUCKET_DISPLAY_NAME, fileName );
Uri photoUri = getContentResolver (). insert (
MediaStore. Images. Media. EXTERNAL_CONTENT_URI, values );
Intent inttPhoto = new Intent (MediaStore. ACTION_IMAGE_CAPTURE );
InttPhoto. putExtra (MediaStore. EXTRA_OUTPUT, photoUri );
StartActivityForResult (inttPhoto, 10 );
14. Select an image from gallery
Intent I = new Intent ();
I. setType ("image /*");
I. setAction (Intent. ACTION_GET_CONTENT );
StartActivityForResult (I, 11 );
15. Enable the recorder
Intent mi = new Intent (Media. RECORD_SOUND_ACTION );
StartActivity (mi );
16. Open another program
Intent I = new Intent ();
ComponentName cn = new ComponentName ("com. yellowbook. android2 ″,
"Com. yellowbook. android2.AndroidSearch ");
I. setComponent (cn );
I. setAction ("android. intent. action. MAIN ");
StartActivityForResult (I, RESULT_ OK );
17. Transfer attachments
Intent it = new Intent (Intent. ACTION_SEND );
It. putExtra (Intent. EXTRA_SUBJECT, "The email subject text ");
It. putExtra (Intent. EXTRA_STREAM, "file: // sdcard/mysong.mp3 ″);
SendIntent. setType ("audio/mp3 ″);
StartActivity (Intent. createChooser (it, "Choose Email Client "));
System action and Service Broadcast
String ADD_SHORTCUT_ACTION: Add a shortcut to the system .. "Android. intent. action. ADD_SHORTCUT"
String ALL_APPS_ACTION: lists all available applications.
Input: none. "Android. intent. action. ALL_APPS"
String ALTERNATIVE_CATEGORY type: indicates that activity is an optional operation on the data you are browsing. "Android. intent. category. ALTERNATIVE"
String ANSWER_ACTION: process the incoming call. "Android. intent. action. ANSWER"
String BATTERY_CHANGED_ACTION broadcast: the charging status, or the battery power changes. "Android. intent. action. BATTERY_CHANGED"
String BOOT_COMPLETED_ACTION broadcast: After the system is started.
This action is broadcast once (only once ). "Android. intent. action. BOOT_COMPLETED"
String BROWSABLE_CATEGORY category: activities that can be safely used by browsers must support this category. "Android. intent. category. BROWSABLE"
String BUG_REPORT_ACTION: displays the activity report error. "Android. intent. action. BUG_REPORT"
String CALL_ACTION: Call.
The called contact is specified in the data. "Android. intent. action. CALL"
String CALL_FORWARDING_STATE_CHANGED_ACTION broadcast: The call transfer status of the voice phone has changed. "Android. intent. action. CFF"
String CLEAR_CREDENTIALS_ACTION: Clear the credential ). "Android. intent. action. CLEAR_CREDENTIALS"
String CONFIGURATION_CHANGED_ACTION broadcast: The device Configuration has changed. For more information, see Resources. Configuration. "android. intent. action. CONFIGURATION_CHANGED"
No Creator, no www.2cto.com
String DATA_ACTIVITY_STATE_CHANGED_ACTION broadcast: The data activity Status of the phone (that is, the status of sending and receiving data) has changed. "Android. intent. action. DATA_ACTIVITY"
String DATA_CONNECTION_STATE_CHANGED_ACTION broadcast: The telephone data connection status has changed. "Android. intent. action. DATA_STATE"
String DATE_CHANGED_ACTION broadcast: the date is changed. "Android. intent. action. DATE_CHANGED"
String DEFAULT_ACTION: Same as VIEW_ACTION, It is a standard action performed on data. "Android. intent. action. VIEW"
String DEFAULT_CATEGORY category: This category is required if activity is an option that saves data (click, center press. "Android. intent. category. DEFAULT"
String DELETE_ACTION: deletes the specified data from the container. "Android. intent. action. DELETE"
String DEVELOPMENT_PREFERENCE_CATEGORY category: indicates that activity is a development panel. "android. intent. category. DEVELOPMENT_PREFERENCE"
String DIAL_ACTION: Call the specified phone number in the data. "Android. intent. action. DIAL"
String EDIT_ACTION: displays the Editable interface for the specified data. "Android. intent. action. EDIT"
String EMBED_CATEGORY type: It can be run in a parent activity. "Android. intent. category. EMBED"
String EMERGENCY_DIAL_ACTION: call an emergency phone number. "Android. intent. action. EMERGENCY_DIAL"
Int FORWARD_RESULT_LAUNCH start flag: If this flag is set.
An existing activity is used to start a new activity. The reply target of the existing activity is transferred to the new activity. 16 0x00000010
String FOTA_CANCEL_ACTION broadcast: cancels all pending (pending) update downloads. "Android. server. checkin. FOTA_CANCEL"
String FOTA_INSTALL_ACTION broadcast: The update has been confirmed and installation will begin immediately. "Android. server. checkin. FOTA_INSTALL"
String FOTA_READY_ACTION broadcast: The update has been downloaded.
You can start installation. "Android. server. checkin. FOTA_READY"
String FOTA_RESTART_ACTION broadcast: Resume stopped update downloads. "Android. server. checkin. FOTA_RESTART"
String FOTA_UPDATE_ACTION broadcast: downloads and installs OS updates through OTA. "Android. server. checkin. FOTA_UPDATE"
String FRAMEWORK_INSTRUMENTATION_TEST_CATEGORY category: To be used as code under test for framework instrumentation tests. "android. intent. category. FRAMEWORK_INSTRUMENTATION _ TEST"
String GADGET_CATEGORY category: this activity can be embedded in the host activity (activity that is hosting gadgets ). "Android. intent. category. GADGET"
String GET_CONTENT_ACTION: allows users to select data and return data. "Android. intent. action. GET_CONTENT"
String HOME_CATEGORY category: activity ).
The first activity displayed after the device is started. "Android. intent. category. HOME"
String INSERT_ACTION: insert an item in the container ). "Android. intent. action. INSERT"
String INTENT_EXTRA additional data: when used together with PICK_ACTIVITY_ACTION, it indicates the activity selected for display; when used together with ADD_SHORTCUT_ACTION, it describes the shortcut to be added. "Android. intent. extra. INTENT"
String LABEL_EXTRA additional data: character tag starting with an upper-case letter, used together with ADD_SHORTCUT_ACTION. "Android. intent. extra. LABEL"
String LAUNCHER_CATEGORY category: the Activity should be displayed in the top-level launcher. "Android. intent. category. LAUNCHER"
String LOGIN_ACTION: Obtain the logon credential. "Android. intent. action. LOGIN"
String MAIN_ACTION: It is started as the main entry point and does not require data. "Android. intent. action. MAIN"
String MEDIABUTTON_ACTION broadcast: the user presses "Media Button ". "Android. intent. action. MEDIABUTTON"
String MEDIA_BAD_REMOVAL_ACTION broadcast: the expansion media (expansion card) has been removed from the SD card slot, but the mount point has not been removed (unmount ). "Android. intent. action. MEDIA_BAD_REMOVAL"
String MEDIA_EJECT_ACTION broadcast: You want to remove the extension media (unplug the expansion card ). "Android. intent. action. MEDIA_EJECT"
String MEDIA_MOUNTED_ACTION broadcast: the extended media is inserted and mounted. "Android. intent. action. MEDIA_MOUNTED"
String MEDIA_REMOVED_ACTION broadcast: the extended media is removed. "Android. intent. action. MEDIA_REMOVED"
String MEDIA_SCANNER_FINISHED_ACTION broadcast: a directory of the media that has been scanned. "Android. intent. action. MEDIA_SCANNER_FINISHED"
String MEDIA_SCANNER_STARTED_ACTION broadcast: starts scanning a directory of the media. "Android. intent. action. MEDIA_SCANNER_STARTED"
String MEDIA_SHARED_ACTION broadcast: the mounting of the extended media is unmounted ).
Because it has been shared as a USB large-capacity storage. "Android. intent. action. MEDIA_SHARED"
String MEDIA_UNMOUNTED_ACTION broadcast: the extended media exists, but it has not been mounted ). "Android. intent. action. MEDIA_UNMOUNTED"
String MESSAGE_WAITING_STATE_CHANGED_ACTION broadcast: the message wait (Voice Mail) Status of the phone has changed. "Android. intent. action. MWI"
Int MULTIPLE_TASK_LAUNCH startup Tag: used together with NEW_TASK_LAUNCH.
You cannot change an existing task to a foreground task (foreground ). 8 0x00000008
String NETWORK_TICKLE_RECEIVED_ACTION broadcast: The device receives a new network "tickle" notification. "Android. intent. action. NETWORK_TICKLE_RECEIVED"
Int NEW_TASK_LAUNCH startup flag: After setting, the activity will become the first new task (top of the stack) in the history stack ). 4 0x00000004
Int NO_HISTORY_LAUNCH start flag: After setting, new activity will not be saved in the history stack. 1 0 × 00000001
String PACKAGE_ADDED_ACTION broadcast: An application package is installed on the device. "Android. intent. action. PACKAGE_ADDED"
String PACKAGE_REMOVED_ACTION broadcast: An application package is deleted from the device. "Android. intent. action. PACKAGE_REMOVED"
String PHONE_STATE_CHANGED_ACTION broadcast: The phone status has changed. "Android. intent. action. PHONE_STATE"
String PICK_ACTION: select an item from the data to return the selected item. "Android. intent. action. PICK"
String PICK_ACTIVITY_ACTION: select an activity and return the class (name) of the selected activity ). "Android. intent. action. PICK_ACTIVITY"
String PREFERENCE_CATEGORY category: activity is a set panel (preference panel ). "Android. intent. category. PREFERENCE"
String PROVIDER_CHANGED_ACTION broadcast: The update will be (real) installed. "Android. intent. action. PROVIDER_CHANGED"
String PROVISIONING_CHECK_ACTION broadcast: requires the polling of provisioning service to download the latest settings. "Android. intent. action. PROVISIONING_CHECK"
String RUN_ACTION action: run data (specified application), regardless of its (application. "Android. intent. action. RUN"
String SAMPLE_CODE_CATEGORY category: To be used as an sample code example (not part of the normal user experience). "android. intent. category. SAMPLE_CODE"
String SCREEN_OFF_ACTION broadcast: the screen is disabled. "Android. intent. action. SCREEN_OFF"
String SCREEN_ON_ACTION broadcast: the screen has been opened. "Android. intent. action. SCREEN_ON"
String SELECTED_ALTERNATIVE_CATEGORY category: for user-selected data.
Activity is an optional operation. "Android. intent. category. SELECTED_ALTERNATIVE"
String SENDTO_ACTION: send a message to the receiver specified by data. "Android. intent. action. SENDTO"
String SERVICE_STATE_CHANGED_ACTION broadcast: the status of the telephone service has changed. "Android. intent. action. SERVICE_STATE"
String SETTINGS_ACTION: displays system settings. Input: none. "Android. intent. action. SETTINGS"
String SIGNAL_STRENGTH_CHANGED_ACTION broadcast: The phone signal strength has changed. "Android. intent. action. SIG_STR"
Int SINGLE_TOP_LAUNCH start flag: After setting, if activity has been started.
At the top of the history stack, the activity will no longer be started (not restarted. 2 0x00000002
String STATISTICS_REPORT_ACTION broadcast: receivers is required to report its own statistics. "Android. intent. action. STATISTICS_REPORT"
String STATISTICS_STATE_CHANGED_ACTION broadcast: The statistics service status has changed. "Android. intent. action. STATISTICS_STATE_CHANGED"
String SYNC_ACTION: Execute data synchronization. "Android. intent. action. SYNC"
String TAB_CATEGORY category: this activity should be used as a tab in TabActivity. "Android. intent. category. TAB"
String TEMPLATE_EXTRA additional data: New Record initialization template. "Android. intent. extra. TEMPLATE"
String TEST_CATEGORY category: used for testing, not part of a normal user experience. "Android. intent. category. TEST"
String TIMEZONE_CHANGED_ACTION broadcast: the time zone has changed. "Android. intent. action. TIMEZONE_CHANGED"
String TIME_CHANGED_ACTION broadcast: the time has been changed (reset ). "Android. intent. action. TIME_SET"
String TIME_TICK_ACTION broadcast: the current time has changed (normal time elapsed ). "Android. intent. action. TIME_TICK"
String UMS_CONNECTED_ACTION broadcast: The device enters the USB high-capacity storage mode. "Android. intent. action. UMS_CONNECTED"
String UMS_DISCONNECTED_ACTION broadcast: The device exits from the USB high-capacity storage mode. "Android. intent. action. UMS_DISCONNECTED"
String UNIT_TEST_CATEGORY category: it should be used as a unit test (run through test harness ). "Android. intent. category. UNIT_TEST"
String VIEW_ACTION action: displays data to the user. "Android. intent. action. VIEW"
String WALLPAPER_CATEGORY Type: this activity can set wallpaper for devices. "Android. intent. category. WALLPAPER"
String WALLPAPER_CHANGED_ACTION broadcast: The system wallpaper has changed. "Android. intent. action. WALLPAPER_CHANGED"
String WALLPAPER_SETTINGS_ACTION: the page for selecting wallpaper is displayed. Input: none. "Android. intent. action. WALLPAPER_SETTINGS"
String WEB_SEARCH_ACTION: executes a web search. "Android. intent. action. WEB_SEARCH"
String XMPP_CONNECTED_ACTION broadcast: the XMPP connection has been established. "Android. intent. action. XMPP_CONNECTED"
String XMPP_DISCONNECTED_ACTION broadcast: the XMPP connection has been disconnected. "Android. intent. action. XMPP_DI
From Sanmee