1 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 dialingProgram, Http://www.g.cn will open the browser and so on.
Code1:
Uri uri = URI. parse ("Http://www.google.com");// Browser// URI uri = URI. parse ("Tel: 1232333"); // dialup Program// URI uri = URI. parse ("Geo: 39.899533, 116.036476"); // open the map to locateIntent it =NewIntent (intent. action_view, Uri); startactivity (it );
Code 2:
// Call the SMS sending programIntent it =NewIntent (intent. action_view); it. putextra ("Sms_body","Information Content..."); It. settype ("Vnd. Android-DIR/MMS-SMS"); Startactivity (it );
Code 3:
// Play the videoIntent intent =NewIntent (intent. action_view); Uri uri = URI. parse ("File: // sdcard/media.mp4"); Intent. setdataandtype (Uri ,"Video /*"); Startactivity (intent );
2 intent. action_sendto
String: Android. Intent. Action. sendto
Description: sends short messages.
// Send Short MessageUri uri = URI. parse ("Smsto: 13200100001"); Intent it =NewIntent (intent. action_sendto, Uri); it. putextra ("Sms_body","Information Content..."); Startactivity (it );
// Send the MMS Message. The device will prompt you to select an appropriate program for sending.Uri uri = URI. parse ("Content: // media/external/images/Media/23");// Resources in the device (images or other resources)Intent intent =NewIntent (intent. action_send); intent. putextra ("Sms_body","Content"); Intent. putextra (intent. extra_stream, Uri); intent. settype ("Image/PNG"); Startactivity (it );
// email 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 ");