1. Search content from Google
New Intent (); intent.setaction (Intent.action_web_search); Intent.putextra (Searchmanager.query,"searchstring ") startactivity (intent);
2. Browse the Web
Uri uri = uri.parse ("http://www.google.com"new Intent (Intent.action_view,uri); StartActivity ( it);
3. Show Map
Uri uri = uri.parse ("geo:38.899533,-77.036476"new Intent (Intent.action_view,uri); StartActivity (it);
4. Path planning
Uri uri = Uri.parse ("http://maps.google.com/maps?f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en "new Intent (Intent.action_view,uri); StartActivity (it);
5. Make a phone call
Uri uri = uri.parse ("tel:xxxxxx"new Intent (intent.action_dial, URI); startactivity (it);
6. Call the program to send SMS
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"new Intent (Intent.action_sendto, URI); It.putextra ( "Sms_body", "The SMS Text"); StartActivity (IT); String Body= "This is SMS Demo"newnulltrueTrue ); 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=NewStringBuilder (); Sb.append ("file://"); Sb.append (Fd.getabsolutefile ()); Intent Intent=NewIntent (Intent.action_sendto, Uri.fromparts ("Mmsto", number,NULL)); //Below Extra datas is 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:[email protected]"); Intent it=NewIntent (Intent.action_sendto, URI); startactivity (it); Intent it=NewIntent (intent.action_send); It.putextra (Intent.extra_email,"[Email protected]"); It.putextra (Intent.extra_text,"The Email body text"); It.settype ("Text/plain"); StartActivity (Intent.createchooser (IT,"Choose Email Client")); Intent it=NewIntent (intent.action_send); String[] TOS={"[Email protected]"}; String[] CCS={"[Email protected]"}; 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=NewIntent (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
New= Uri.parse ("File:///sdcard/song.mp3""Audio/mp3"= Uri.withappendedpath ( MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"new Intent (Intent.action_view, URI); StartActivity (it);
11.uninstall apk
Nullnew Intent (Intent.action_delete, URI); startactivity (it);
12.install apk
Nullnew Intent (intent.action_package_added, Installuri);
13. Turn on the camera
Method One:
Intent i =NewIntent (Intent.action_camera_button,NULL); This. Sendbroadcast (i);
Method Two
LongDatetaken =System.currenttimemillis (); String name= Createname (Datetaken) + ". jpg"; FileName= Folder +name; Contentvalues Values=Newcontentvalues (); 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=NewIntent (mediastore.action_image_capture); Inttphoto.putextra (Mediastore.extra_output, Photouri); Startactivityforresult (Inttphoto,10);
14. Select a picture from gallery
New Intent (); I.settype ("image/*"11);
15. Turn on the recorder
New Intent (media.record_sound_action); startactivity (MI);
16. Show App Detail List
Uri uri = uri.parse ("market://details?id=app_id"new/ /// //page, and notice the ID from the address bar= Uri.parse ("market://details?id=< Packagename> "); That's a lot easier.
17 Finding applications
Uri uri = uri.parse ("market://search?q=pname:pkg_name"new//where pkg_name is the full package path to an application
18 Open a contact list
New Intent (); i.setaction (intent.action_get_content); I.settype ("Vnd.android.cursor.item/phone"= Uri.parse ("Content://contacts/people"new Intent (Intent.action_pick, URI); Startactivityforresult (it, request_text);
19 Open Another program
Newnew componentname ("Com.yellowbook.android2"" Com.yellowbook.android2.AndroidSearch "); I.setcomponent (CN); I.setaction ("Android.intent.action.MAIN"); Startactivityforresult (i, RESULT_OK);
20. Call System Editor to add a contact (the High version SDK is valid):
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 system Edit Add contact (all valid):
Intent Intent ="My Name""+1234567890""[email protected]"); Intent.putextra ( Contacts.Intents.Insert.EMAIL_TYPE, Contacts.ContactMethodsColumns.TYPE_WORK); startactivity (intent);
Turn from Intent,action, Daquan
Common Intent.action for Android development "turn"