Intent binds URI

Source: Internet
Author: User

The following is the commonly used intent Uri and its example, including the common intent used in most applications.

1. Open a webpage. the category is intent. action_view.

Uri uri = URI. parse ("http://blog.3stdy.com /");

Intent intent = new intent (intent. action_view, Uri );

2. Open the map and locate a point

Uri uri = URI. parse ("Geo: 52.76,-79.0342 ″);

Intent intent = new intent (intent. action_view, Uri );

3. Open the dialing interface. The type is intent. action_dial.

Uri uri = URI. parse ("Tel: 10086 ″);

Intent intent = new intent (intent. action_dial, Uri );

4. Direct Dialing. The difference between the two is that direct dialing is not to open the dialing interface.

Uri uri = URI. parse ("Tel: 10086 ″);

Intent intent = new intent (intent. action_call, Uri );

5. Uninstall an application. The intent category is intent. action_delete.

Uri uri = URI. fromparts ("package", "XXX", null );

Intent intent = new intent (intent. action_delete, Uri );

6. Install the application. The intent category is intent. action_package_added.

Uri uri = URI. fromparts ("package", "XXX", null );

Intent intent = new intent (intent. action_package_added, Uri );

VII. play audio files

Uri uri = URI. parse ("file: // sdcard/download/everything ″);

Intent intent = new intent (intent. action_view, Uri );

Intent. settype ("audio/MP3 ″);

8. open the mail Interface

Uri uri = URI. parse ("mailto: admin@3gstdy.com ");

Intent intent = new intent (intent. action_sendto, Uri );

9. send an email. Unlike sending an email,

Intent intent = new intent (intent. action_send );

String [] TOS = {"admin@3gstdy.com "};

String [] CCS = {"webmaster@3gstdy.com "};

Intent. putextra (intent. extra_email, TOS );

Intent. putextra (intent. extra_cc, CCS );

Intent. putextra (intent. extra_text, "I come from
Http://blog.3gstdy.com ");

Intent. putextra (intent. extra_subject, "http://blog.3gstdy.com"); intent. settype ("Message/rfc882 ″);

Intent. createchooser (intent, "choose email client ");

// Send an email with an attachment

Intent intent = new intent (intent. action_send );

Intent. putextra (intent. extra_subject, "The Email Subject text ");

Intent. putextra (intent. extra_stream, "file: // sdcard/mysong.mp3 ″);

Intent. settype ("audio/MP3 ″);

Startactivity (intent. createchooser (intent, "choose email client "));

10. Text Messages

Uri uri = URI. parse ("Tel: 10086 ″);

Intent intent = new intent (intent. action_view, Uri );

Intent. putextra ("sms_body", "I come from
Http://blog.3gstdy.com ");

Intent. settype ("vnd. Android-DIR/MMS-SMS ");

11. Direct Mail

Uri uri = URI. parse ("smsto: // 100861 ″);

Intent intent = new intent (intent. action_sendto, Uri );

Intent. putextra ("sms_body", "3G android
Http://blog.3gstdy.com ");

12. Send MMS messages

Uri uri = URI. parse ("content: // media/external/images/Media/23 ″);

Intent intent = new intent (intent. action_send );

Intent. putextra ("sms_body", "3G android
Http://blog.3gstdy.com ");

Intent. putextra (intent. extra_stream, Uri );

Intent. settype ("image/PNG ");

13. # market problems

1 // search for an application

Uri uri = URI. parse ("Market: // search? Q = pname: pkg_name ");

Intent it = new intent (intent. action_view, Uri );

Startactivity (it );

// Where pkg_name is the full package path for an application

2 // display information about an application

Uri uri = URI. parse ("Market: // details? Id = app_id ");

Intent it = new intent (intent. action_view, Uri );

Startactivity (it );

// Where app_id is the Application ID, find the ID

// By clicking on your application on market Home

// Page, and notice the ID from the address bar

14. Route 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 );

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.