Android-intent. Action (2)

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, 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 "); 
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.