The URI and example of common intent for Android development

Source: Internet
Author: User

Reference: http://www.oschina.net/code/snippet_166763_6502

The following is the URI of the commonly used intent and its examples, including the common intent used in most applications. One, open a Web page, the category is Intent.action_viewuri uri = Uri.parse ("http://blog.3gstdy.com/"); Intent Intent = new Intent ( Intent.action_view, URI);//second, open the map and navigate to a point URI uri = Uri.parse ("Geo:52.76,-79.0342″); Intent Intent = new Intent ( Intent.action_view, URI);//Three, open dial interface, type is Intent.action_dialuri uri = Uri.parse ("Tel:10086″); Intent Intent = new Intent ( Intent.action_dial, URI);//four, direct dialing, unlike three, this direct call, instead of opening the dial-up interface uri URI = Uri.parse ("Tel:10086″"); Intent Intent = new Intent (Intent.action_call, URI);//Five, uninstall an application, Intent category is Intent.action_deleteuri uri = uri.fromparts ("package", "XXX", NULL); Intent Intent = new Intent (Intent.action_delete, URI);//VI, install the application, Intent the category is Intent.action_package_addeduri URI = Uri.fromparts ("package", "XXX", null); Intent Intent = new Intent (intent.action_package_added, URI);//Seven, play audio file uri uri = Uri.parse ("File:///sdcard/download/everything.mp3″"); Intent Intent = new Intent (Intent.action_view, URI); Intent.settype ("Audio/mp3″");//Eight, open the outgoing mail interface Uri uri= URI.Parse ("mailto:[email protected]"); Intent Intent = new Intent (intent.action_sendto, URI);//IX, e-mail, with eight different here is to send the mail out , Intent Intent = new Intent (intent.action_send); String[] tos = {"[email protected]"}; String[] CCS = {"[email protected]"};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 Intent Intent = new Intent (intent.action_send); Intent.putextra (Intent.extra_subject, "The e-mail Subject text "); Intent.putextra (Intent.extra_stream," File:///sdcard/mysong.mp3″ "); Intent.settype (" Audio/mp3″ "); StartActivity (Intent.createchooser (Intent, "Choose Email Client"));//10. Send SMS 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 email 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 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 Related// 1//Look for an app 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 to an APPLICATION//2//displays information about an app 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, path planning uri uri = Uri.parse ("http://maps.google.com/maps?f=d&Amp;saddr=startlat%20startlng&daddr=endlat%20endlng&hl=en "); Intent it = new Intent (Intent.action_view, URI) ; startactivity (it);

I have not tried so much, wait for a time to try!!!

The URI and example of common intent for Android development

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.