I want to use action_send share picture + text, I run the following code, temporarily only share pictures, can't share text, how can I share?
Private Uri Imageuri; Private Intent Intent; Imageuri = Uri.parse ("android.resource://" + getpackagename () + "/drawable/" + "Ic_launcher"); Intent = new Intent (); Intent.setaction (intent.action_send); Intent.putextra (Intent.extra_text, "Hello"); Intent.putextra (Intent.extra_stream, Imageuri); Intent.settype ("image/*"); StartActivity (Intent);
How can I share a picture?
Processing methods
You can share the following code:
String Sharebody = "Here is the share content body";
Intent sharingintent = new Intent (Android.content.Intent.ACTION_SEND);
Sharingintent.settype ("Text/plain");
Sharingintent.putextra (Android.content.Intent.EXTRA_SUBJECT, "SUBJECT here");
Sharingintent.putextra (Android.content.Intent.EXTRA_TEXT, sharebody);
StartActivity (Intent.createchooser (Sharingintent, Getresources (). getString (r.string.share_using)));
So all your code (picture + text) needs to become
Private Uri imageuri;private Intent Intent; Imageuri = Uri.parse ("android.resource://" + getpackagename () + "/drawable/" + "Ic_launcher"); Intent = new Intent (intent.action_send);//textintent.putextra (Intent.extra_text, "Hello");//imageintent.putextra ( Intent.extra_stream, Imageuri);//type of Thingsintent.settype ("*/*");//sendingstartactivity (Intent);
Replace the image/* with */*
Update:
Uri Imageuri = Uri.parse ("android.resource://" + getpackagename () + "/drawable/" + "Ic_launcher"); Intent shareintent = new Intent (); shareintent.setaction (intent.action_send); Shareintent.putextra (Intent.extra_text, "Hello"); Shareintent.putextra (Intent.extra_stream, Imageuri); Shareintent.settype ("Image/jpeg"); ShareIntent.addFlags ( intent.flag_grant_read_uri_permission); StartActivity (Intent.createchooser (shareintent, "send"));
Original address: http://www.itmmd.com/201411/214.html
This article by Meng Meng's IT person to organize the release, reprint must indicate the source.
How to share pictures and text in Android development using Action_send