[Reprint]android Common API interface calls

Source: Internet
Author: User

Original address:Android Common API interface call song

Show Web page:
Uri uri = Uri.parse ("http://www.google.com");
Intent it = new Intent (Intent.action_view,uri);
StartActivity (IT);
Show Map:
Uri uri = uri.parse ("geo:38.899533,-77.036476");

Uri uri = uri.parse ("geo:38.899533,-77.036476?q=street+address");//Opens the map and displays the specified address
Intent it = new Intent (Intent.action_view,uri);
StartActivity (IT);

Path planning:
Uri uri = Uri.parse ("http://maps.google.com/maps?f=d&saddr=startLat Startlng&daddr=endlat Endlng&hl =en");
Intent it = new Intent (Intent.action_view,uri);
StartActivity (IT);

Dial number:
Call the dialer URI uri = uri.parse ("tel:xxxxxx");
Intent it = new Intent (intent.action_dial, URI);
StartActivity (IT);

Send Sms/mms:
Call the program that sends the SMS Intent it = new Intent (Intent.action_view);
It.putextra ("Sms_body", "The SMS Text");
It.settype ("vnd.android-dir/mms-sms");
StartActivity (IT);
Send sms URI uri = uri.parse ("smsto:0800000123");
Intent it = new Intent (intent.action_sendto, URI);
It.putextra ("Sms_body", "The SMS Text");
StartActivity (IT);
Send mms uri uri = uri.parse ("Content://media/external/images/media/23");
Intent it = new Intent (intent.action_send);
It.putextra ("Sms_body", "some text");
It.putextra (Intent.extra_stream, URI);
It.settype ("Image/png");
StartActivity (IT);

Send email
Uri uri = uri.parse ("mailto:[email protected]");
Intent it = new Intent (intent.action_sendto, URI);
StartActivity (IT);

Intent it = new Intent (intent.action_send);
It.putextra (Intent.extra_email, "[email protected] ");
It.putextra (Intent.extra_text, "The email body TEXT");
It.settype ("Text/plain");
StartActivity (Intent.createchooser (it, "Choose Email Client"));

Intent it=new Intent (intent.action_send);
string[] tos={" [email protected] "};
string[] ccs={" [email protected] "};
It.putextra (Intent.extra_email, TOS);
It.putextra (INTENT.EXTRA_CC, CCS);
It.putextra (Intent.extra_text, "The email body TEXT");
It.putextra (Intent.extra_subject, "The email SUBJECT text");
It.settype ("message/rfc822");
StartActivity (Intent.createchooser (it, "Choose Email Client"));

Add an attachment
Intent it= New Intent (intent.action_send);
It.putextra (Intent.extra_subject, "The email SUBJECT text");
It.putextra (Intent.extra_stream, "File:///sdcard/mysong.mp3");
Sendintent.settype ("Audio/mp3");
StartActivity (Intent.createchooser (it, "Choose Email Client"));

Play Multimedia
Intent it = new Intent (Intent.action_view);
Uri uri = Uri.parse ("File:///sdcard/song.mp3");
It.setdataandtype (URI, "Audio/mp3");
StartActivity (IT);

Uri uri = Uri.withappendedpath (MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
Intent it = new Intent (Intent.action_view, URI);
StartActivity (IT);

Uninstall uri uri = uri.fromparts ("package", strpackagename, NULL);
Intent it = new Intent (Intent.action_delete, URI);
StartActivity (IT);
More intent can view: http://wenku.baidu.com/view/ae689266783e0912a2162a46.html

Intent action and URI combinations in popular Android apps and their descriptions

Action Uri Description

Intent.action_view

Geo:latitude,longtitude

Open the map application and display the specified latitude and longitude

Intent.action_view

Geo:0,0?q=street+address

Open the map application and display the specified address

Intent.action_call

Tel:phone_number

Open the phone application and dial the specified phone number

Intent.action_dial

Tel:phone_number

Open the phone application and dial the designated phone (but not the typing)

Intent.action_dial

Voicemail:

Open the phone application and dial the voicemail number (but not the typing)

Intent.action_view

Http://web_address

Opens the browser application and displays the specified URL

Intent.action_view

Https://web_address

Opens the browser application and displays the specified URL

Intent.action_web_search

Plain_text

Open the browser app and use the Google search engine

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.