Action_send Small example of Android

Source: Internet
Author: User

We know that the system has a lot of action (action/activity) in Android, and by adding action information through intent, we can implement many system functions, such as opening albums, taking pictures, sending messages, etc. In the work, often use action_send this action, do a small summary, record down.

1, e-mail:

Uri uri= uri.parse ("Content://media/external/images/media/23");
Intent intent= New Intent (intent.action_send);
Intent.putextra ("Sms_body", "Shenrenkui");
Intent.putextra (Intent.extra_stream, URI);
Intent.settype ("Image/png");

StartActivity (Intent)

2, send mms:

Uri uri = uri.parse ("Content://media/external/images/media/23");
Intent Intent = new Intent (intent.action_send);
Intent . PutExtra ("Sms_body", "My Information");
Intent . PutExtra (Intent.extra_stream, URI);
Intent . SetType ("Image/png");

Next is the main feature of today, is to share the implementation of the function, we can realize the sharing function through the action_send, call up the mobile phone installed sharing software, and share our information out.

/** shared by intent*/
Intent Intent = new Intent (intent.action_send);
/** types of data shared */
Intent.settype ("Text/plain");
/** shared Theme (title) */
Intent.putextra (Intent.extra_subject, "friends sharing");
/** content */
Intent.putextra (Intent.extra_text, "I am using the fast code, you also join it!! ");
/** allows you to start a new activity */
Intent.setflags (Intent.flag_activity_new_task);
/** Target application Look for the title of the dialog box */
StartActivity (Intent.createchooser (Intent, "title"));

This will call the appropriate sharing app, such as SMS, e-mail, etc.

Action_send Small example of Android

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.