Android-intent. Action

Source: Internet
Author: User

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"));  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.