The following content is reproduced from: http://shazhuzhu1.iteye.com/blog/1095694
Android calls system programs
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 = newintent (intent. action_view, Uri );
Startactivity (it );
4. Route Planning
Uri uri = URI. parse ("http://maps.google.com/maps? F = dsaddr = startlat % 20 startlng & daddr = endlat % 20 endlng & HL = EN ");
Intent it = newintent (intent. action_view, Uri );
Startactivity (it );
5. Call
Uri uri = URI. parse ("Tel: xxxxxx ");
Intent it = new intent (intent. action_dial, Uri );
Startactivity (it );
6. Call the SMS Program
Method 1:
Intent it = newintent (intent. action_view );
It. putextra ("sms_body", "thesms text ");
It. settype ("Vnd. Android-DIR/MMS-SMS ");
Startactivity (it );
7. send SMS
Method 2:
Uri uri = URI. parse ("smsto: 0800000123 ");
Intent it = newintent (intent. action_sendto, Uri );
It. putextra ("sms_body", "thesms text ");
Startactivity (it );
Method 3:
String body = "this is SMS Demo ";
Intent mmsintent = newintent (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 = newintent (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 = newintent (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 = newintent (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, "theemail 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, "theemail body text ");
It. putextra (intent. extra_subject, "theemail subject text ");
It. settype ("message/rfc822 ");
Startactivity (intent. createchooser (IT, "Choose email client "));
Intent it = newintent (intent. action_send );
It. putextra (intent. extra_subject, "theemail 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 = newintent (intent. action_delete, Uri );
Startactivity (it );
12. Install APK
Uri installuri = URI. fromparts ("package", "XXX", null );
Returnit = newintent (intent. action_package_added, installuri );
Intent intent = new intent (intent. action_view );
Intent. setdataandtype (URI. parse ("file: //" + filepath), "application/vnd. Android. Package-Archive ");
Startactivity (intent); // install
13. Open the camera
<1> intent = new intent ("android. Media. Action. still_image_camera"); // call the camera
Startactivity (intent );
<2> intent I = new intent (intent. action_camera_button, null );
This. sendbroadcast (I );
<3> long datetaken = system. currenttimemillis ();
String name = createname (datetaken) + ". 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. display the detailed list of applications
Uri uri = URI. parse ("Market: // details? Id = app_id ");
Intent it = new intent (intent. action_view, Uri );
Startactivity (it );
// Where app_id is the Application ID, findthe ID
// By clicking on your application on markethome
// Page, and notice the ID from the addressbar
Failed to find the app Id just now. It turns out that the package name can also be used.
Uri uri = URI. parse ("Market: // details? Id = <packagename> ");
This is much simpler.
17. Search for Applications
Uri uri = URI. parse ("Market: // search? Q = pname: pkg_name ");
Intent it = new intent (intent. action_view, Uri );
Startactivity (it );
// Where pkg_name is the full package pathfor an application
18 open the contact list
<1>
Intent I = new intent ();
I. setaction (intent. action_get_content );
I. settype ("Vnd. Android. cursor. Item/phone ");
Startactivityforresult (I, request_text );
<2>
Uri uri = URI. parse ("content: // contacts/People ");
Intent it = new intent (intent. action_pick, Uri );
Startactivityforresult (it, request_text );
19 open another program
Intent I = new intent ();
Componentname Cn = newcomponentname ("com. yellowbook. android2 ",
"Com. yellowbook. android2.androidsearch ");
I. setcomponent (CN );
I. setaction ("android. Intent. Action. Main ");
Startactivityforresult (I, result_ OK );
20. Call the system editor to add a contact (for later SDK versions ):
Intent it = newintent (intent. action_insert_or_edit );
It. settype ("Vnd. Android. cursor. Item/contact ");
// It. settype (contacts. content_item_type );
It. putextra ("name", "myname ");
It. putextra (Android. provider. Contacts. intents. Insert. Company, "Organization ");
It. putextra (Android. provider. Contacts. intents. Insert. email, "email ");
It. putextra (Android. provider. Contacts. intents. Insert. Phone, "homephone ");
It. putextra (Android. provider. Contacts. intents. Insert. secondary_phone,
"Mobilephone ");
It. putextra (Android. provider. Contacts. intents. Insert. tertiary_phone,
"Workphone ");
It. putextra (Android. provider. Contacts. intents. Insert. job_title, "title ");
Startactivity (it );
21. Call the system editor to add a contact (all valid ):
Intent intent = newintent (intent. action_insert_or_edit );
Intent. settype (people. content_item_type );
Intent. putextra (contacts. intents. Insert. Name, "my name ");
Intent. putextra (contacts. intents. Insert. Phone, "+ 1234567890 ");
Intent. putextra (contacts. intents. Insert. phone_type, contacts. phonescolumns. type_mobile );
Intent. putextra (contacts. intents. Insert. email, "com@com.com ");
Intent. putextra (contacts. intents. Insert. email_type, contacts. contactmethodscolumns. type_work );
Startactivity (intent );
SDK documentation android_sdk/docs/GUIDE/Appendix/g-app-intents.html
★Intent action Daquan:
Android. Intent. Action. all_apps
Android. Intent. Action. Answer
Android. Intent. Action. attach_data
Android. Intent. Action. bug_report
Android. Intent. Action. Call
Android. Intent. Action. call_button
Android. Intent. Action. chooser
Android. Intent. Action. create_live_folder
Android. Intent. Action. create_shortcut
Android. Intent. Action. Delete
Android. Intent. Action. Dial
Android. Intent. Action. Edit
Android. Intent. Action. get_content
Android. Intent. Action. insert
Android. Intent. Action. insert_or_edit
Android. Intent. Action. Main
Android. Intent. Action. media_search
Android. Intent. Action. Pick
Android. Intent. Action. pick_activity
Android. Intent. Action. ringtone_picker
Android. Intent. Action. Run
Android. Intent. Action. Search
Android. Intent. Action. search_long_press
Android. Intent. Action. Send
Android. Intent. Action. sendto
Android. Intent. Action. set_wallpaper
Android. Intent. Action. sync
Android. Intent. Action. system_tutorial
Android. Intent. Action. View
Android. Intent. Action. voice_command
Android. Intent. Action. web_search
Android.net. Wifi. pick_wifi_network
Android. settings. airplane_mode_settings
Android. settings. apn_settings
Android. settings. application_development_settings
Android. settings. application_settings
Android. settings. effecth_settings
Android. settings. data_roaming_settings
Android. settings. date_settings
Android. settings. display_settings
Android. settings. input_method_settings
Android. settings. internal_storage_settings
Android. settings. locale_settings
Android. settings. location_source_settings
Android. settings. manage_applications_settings
Android. settings. memory_card_settings
Android. settings. network_operator_settings
Android. settings. quick_launch_settings
Android. settings. security_settings
Android. settings. Settings
Android. settings. sound_settings
Android. settings. sync_settings
Android. settings. user_dictionary_settings
Android. settings. wifi_ip_settings
Android. settings. wifi_settings
Android. settings. wireless_settings