I want to use action_send share picture + text, I run the following code, temporarily can only share pictures, can't share text, how can I share?
| The code is as follows |
Copy Code |
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 pictures?
Processing methods
You can share the following code:
| The code is as follows |
Copy Code |
String Sharebody = "This 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
| code is as follows |
copy code |
private Uri Imageuri;
Private Intent Intent;
Imageuri = Uri.parse ("android.resource://" + getpackagename ()
+ "/drawable/" + "Ic_launcher");
&n Bsp
Intent = new Intent (intent.action_send);
//text
Intent.putextra (intent.extra_text, "Hello");
//image
Intent.putextra (Intent.extra_stream, Imageuri);
//type of Things
Intent.settype ("*/*");
//sending
StartActivity (intent); |