Intent call Daquan, the most comprehensive in history

Source: Internet
Author: User
Home> Android development> text Intent call Daquan, the most comprehensive in history
  • Release date:
  • Author:Original Android Development Network

// Call the browser

Uri uri = Uri. parse ("");
Intent it = new Intent (Intent. ACTION_VIEW, uri );
StartActivity (it );

// Display a coordinate on the map

Uri uri = Uri. parse ("geo: 38.899533,-77.036476 ");
Intent it = new Intent (Intent. Action_VIEW, uri );
StartActivity (it );

// Display path

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 );

// Call

Uri uri = Uri. parse ("tel: 10086 ");
Intent it = new Intent (Intent. ACTION_DIAL, uri );
StartActivity (it );

Uri uri = Uri. parse ("tel.10086 ");
Intent it = new Intent (Intent. ACTION_CALL, uri );
You need to add the <uses-permission id = "android. permission. CALL_PHONE"/> permission to androidmanifest. xml

// Send SMS or MMS

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: 10086 ");
Intent it = new Intent (Intent. ACTION_SENDTO, uri );
It. putExtra ("sms_body", "cwj ");
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 an email
Uri uri = Uri. parse ("mailto: android123@163.com ");
Intent it = new Intent (Intent. ACTION_SENDTO, uri );
StartActivity (it );

Intent it = new Intent (Intent. ACTION_SEND );
It. putExtra (Intent. EXTRA_EMAIL, android123@163.com );
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 = {"me@abc.com "};
String [] ccs = {"you@abc.com "};
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 "));

// Play a media file

Intent it = new Intent (Intent. ACTION_VIEW );
Uri uri = Uri. parse ("file: // sdcard/cwj.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 APK

Uri uri = Uri. fromParts ("package", strPackageName, null );
Intent it = new Intent (Intent. ACTION_DELETE, uri );
StartActivity (it );

// Uninstall apk 2
Uri uninstallUri = Uri. fromParts ("package", "xxx", null );
ReturnIt = new Intent (Intent. ACTION_DELETE, uninstallUri );

// Install APK
Uri installUri = Uri. fromParts ("package", "xxx", null );
ReturnIt = new Intent (Intent. ACTION_PACKAGE_ADDED, installUri );

// Play music

Uri playUri = Uri. parse ("file: // sdcard/download/sth.mp3 ");
ReturnIt = new Intent (Intent. ACTION_VIEW, playUri );

// Sending nearby

Intent it = new Intent (Intent. ACTION_SEND );
It. putExtra (Intent. EXTRA_SUBJECT, "The email subject text ");
It. putExtra (Intent. EXTRA_STREAM, "file: // sdcard/cwj.mp3 ");
SendIntent. setType ("audio/mp3 ");
StartActivity (Intent. createChooser (it, "Choose Email Client "));

// An application message on the market. pkg_name is the packageName of the application.

Uri uri = Uri. parse ("market: // search? Q = pname: pkg_name ");
Intent it = new Intent (Intent. ACTION_VIEW, uri );
StartActivity (it );

// The app_id of an application on the market can be viewed on the www website.

Uri uri = Uri. parse ("market: // details? Id = app_id ");
Intent it = new Intent (Intent. ACTION_VIEW, uri );
StartActivity (it );

// Call Search

Intent intent = new Intent ();
Intent. setAction (Intent. ACTION_WEB_SEARCH );
Intent. putExtra (SearchManager. QUERY, "android123 ")
StartActivity (intent );

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.