Android Intent usage

Source: Internet
Author: User

1. Tune the web browser

Uri myBlogUri = Uri. parse ("http://kuikui.javaeye.com ");

ReturnIt = new Intent (Intent. ACTION_VIEW, myBlogUri );

2. Map

Uri mapUri = Uri. parse ("geo: 38.899533,-77.036476 ");

ReturnIt = new Intent (Intent. ACTION_VIEW, mapUri );

3. Transfer call interface

Uri telUri = Uri. parse ("tel: 100861 ");

ReturnIt = new Intent (Intent. ACTION_DIAL, telUri );

4. Call directly

Uri callUri = Uri. parse ("tel: 100861 ");

ReturnIt = new Intent (Intent. ACTION_CALL, callUri );

5. Uninstall

Uri uninstallUri = Uri. fromParts ("package", "xxx", null );

ReturnIt = new Intent (Intent. ACTION_DELETE, uninstallUri );

6. Install

Uri installUri = Uri. fromParts ("package", "xxx", null );

ReturnIt = new Intent (Intent. ACTION_PACKAGE_ADDED, installUri );

7. Play

Uri playUri = Uri. parse ("file: // sdcard/download/everything.mp3 ");

ReturnIt = new Intent (Intent. ACTION_VIEW, playUri );

8. Call to send an email

Uri emailUri = Uri. parse ("mailto: shenrenkui@gmail.com ");

ReturnIt = new Intent (Intent. ACTION_SENDTO, emailUri );

9. send an email

ReturnIt = new Intent (Intent. ACTION_SEND );

String [] tos = {"shenrenkui@gmail.com "};

String [] ccs = {"shenrenkui@gmail.com "};

ReturnIt. putExtra (Intent. EXTRA_EMAIL, tos );

ReturnIt. putExtra (Intent. EXTRA_CC, ccs );

ReturnIt. putExtra (Intent. EXTRA_TEXT, "body ");

ReturnIt. putExtra (Intent. EXTRA_SUBJECT, "subject ");

ReturnIt. setType ("message/rfc882 ");

Intent. createChooser (returnIt, "Choose Email Client ");

10. send text messages

Uri smsUri = Uri. parse ("tel: 100861 ");

ReturnIt = new Intent (Intent. ACTION_VIEW, smsUri );

ReturnIt. putExtra ("sms_body", "shenrenkui ");

ReturnIt. setType ("vnd. android-dir/mms-sms ");

11. send an email directly.

Uri smsToUri = Uri. parse ("smsto: // 100861 ");

ReturnIt = new Intent (Intent. ACTION_SENDTO, smsToUri );

ReturnIt. putExtra ("sms_body", "shenrenkui ");

12. Send MMS messages

Uri mmsUri = Uri. parse ("content: // media/external/images/media/23 ");

ReturnIt = new Intent (Intent. ACTION_SEND );

ReturnIt. putExtra ("sms_body", "shenrenkui ");

ReturnIt. putExtra (Intent. EXTRA_STREAM, mmsUri );

ReturnIt. setType ("image/png ");

Use the obtained Intent to directly call startActivity (returnIt.
Note:
This 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.