Display web pages:
Uri uri = URI. parse ("http://www.android123.com.cn ");
Intent it = new intent (intent. action_view, Uri );
Startactivity (it );
Show Google maps:
Uri uri = URI. parse ("Geo: 38.899533,-77.036476 ");
Intent it = new intent (intent. action_view, Uri );
Startactivity (it );
Maps Path Planning:
Uri uri = URI. parse ("http://maps.google.com/maps? F = D & saddr = startlat % 20 startlng & daddr = endlat % 20 endlng & HL = EN ");
Intent it = new intent (intent. action_view, Uri );
Startactivity (it );
Call number:
Uri uri = URI. parse ("Tel: xxxxxx ");
Intent it = new intent (intent. action_dial, Uri );
Startactivity (it );
Uri uri = URI. parse ("Tel. xxxxxx ");
Intent it = new intent (intent. action_call, Uri );
Note that permissions are required.
<Uses-Permission id = "android. Permission. call_phone"/>
Send SMS/MMS
Intent it = new intent (intent. action_view );
It. putextra ("sms_body", "Welcome to Android Development Network ");
It. settype ("Vnd. Android-DIR/MMS-SMS ");
Startactivity (it );
Send SMS
Uri uri = URI. parse ("smsto: 10086 ");
Intent it = new intent (intent. action_sendto, Uri );
It. putextra ("sms_body", "10086"); // The body is 10086
Startactivity (it );
Send MMS
Uri uri = URI. parse ("content: // media/external/images/Media/10"); // This URI is modified based on the actual situation. External indicates that external storage is sdcard.
Intent it = new intent (intent. action_send );
It. putextra ("sms_body", "android123.com.cn ");
It. putextra (intent. extra_stream, Uri );
It. settype ("image/PNG ");
Startactivity (it );
Send email
Uri uri = URI. parse ("mailto: android123@163.com ");
Intent it = new intent (intent. action_sendto, Uri );
Startactivity (it); intent it = new intent (intent. action_send );
It. putextra (intent. extra_email, "android123@163.com ");
It. putextra (intent. extra_text, "android development network test ");
It. settype ("text/plain ");
Startactivity (intent. createchooser (IT, "select an email client"); intent it = new intent (intent. action_send );
String [] TOS = {"android123@163.com"}; // send
String [] CCS = {"ophone123@163.com"}; // CC
It. putextra (intent. extra_email, TOS );
It. putextra (intent. extra_cc, CCS );
It. putextra (intent. extra_text, "body ");
It. putextra (intent. extra_subject, "title ");
It. settype ("message/rfc822"); // encoding type
Startactivity (intent. createchooser (IT, "select an email client "));
Add attachments by email
Intent it = new intent (intent. action_send); it. putextra (intent. extra_subject, "body"); it. putextra (intent. extra_stream, "file: // sdcard/nobody.pdf"); // the attachment is the sendintent of the nobody MP3 file on the SD card. settype ("audio/MP3"); startactivity (intent. createchooser (IT, "select an email client "));
Play multimedia
Intent it = new intent (intent. action_view); Uri uri = Uri. parse ("file: // sdcard/nobody.pdf"); it. setdataandtype (Uri, "audio/MP3"); startactivity (it); Uri uri = Uri. withappendedpath (mediastore. audio. media. internal_content_uri, "1"); // play intent it = new intent (intent. action_view, Uri); startactivity (it );
Uninstall uninstall the program
Uri uri = URI. fromparts ("package", packagename, null); // packagenameis the package name, such as com.android123.apk installer intent it = new intent (intent. action_delete, Uri); startactivity (it );
Enter the contact page
Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(People.CONTENT_URI); startActivity(intent);
View a contact. Of course, this is action_view. If you select and change the Return Action to action_pick, startactivityforresult is required for intent processing.
Uri personuri = contenturis. withappendedid (people. content_uri, ID); // The last Id parameter is the database baseid in the contact provider, that is, the row of intent = new intent (); intent. setaction (intent. action_view); intent. setdata (personuri); startactivity (intent );
Select an image
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("image/*"); startActivityForResult(intent, 0);
Source: http://chenyu0748.iteye.com/blog/1026364