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, if Tel: 13400010001 is used to open the dialing program, the browser will be opened at http://www.g.cn.
Code 1:
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 locate intent it = new intent (intent. action_view, Uri); startactivity (it );
Code 2:
// Call the program intent it = new intent (intent. action_view); it. putextra ("sms_body", "information content... "); it. settype ("Vnd. android-DIR/MMS-SMS "); startactivity (it );
Code 3:
// Play the video intent = new intent (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 Message uri = Uri. parse ("Maid: 13200100001"); intent it = new intent (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 to send URI uri = Uri. parse ("content: // media/external/images/Media/23"); // Resources in the device (images or other resources) intent = new intent (intent. action_send); intent. putextra ("sms_body", "content"); intent. putextra (intent. extra_stream, Uri); intent. settype ("image/PNG"); startactivity (it );
//EmailIntent 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"));