I could understand from various post that it is not possible to share both the image and text data in Facebook through intent share. But Twitter is able to share both thumbnail and text in Facebook through intent share which is shown in the image. SO can u comment on this and suggest a way to share both image and text in Facebook through intent.
Thanks in advance.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_TEXT, viewProject.getShareLink());
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "compatible apps:"));
Related
I know this question has been asked many times and in many different ways (see here and here). However, I haven't been able to achieve it in the following way:
The picture and the title are in the same section. Then, there is the rest with the link in another section. I have achieved to put text and image together, but the picture is on the top of the text.
This is the code I am using:
Intent intent = new Intent();
intent.setComponent(new ComponentName(packageName, ri.activityInfo.name));
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, shareContentByWhatsapp(contentType));
intent.putExtra(Intent.EXTRA_STREAM, getImage());
intent.setType("image/*");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Does anyone know how to obtain same result than in the picture?
As image you have shared,
In this case you just need to share the link,
image and link related content will be fetched by WhatsApp itself.
You can do like this:
Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
whatsappIntent.setType("text/plain");
whatsappIntent.setPackage("com.whatsapp");
whatsappIntent.putExtra(Intent.EXTRA_TEXT, "http://www.google.com");
mContext.startActivity(whatsappIntent);
or, you can share image with caption.
But, image you have shared, is whatsapp's functionality :-)
I would like to ask if anyone knows how to attach an image directly to a send email portal instead of opening up the gallery for users to select?
Thanks a lot.
use the below code
File file = new File(Environment.getExternalStorageDirectory(),"image.png");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+file));
startActivity(Intent.createChooser(intent, "Share Picture Via Email"));
I put a button to share my Android app on Facebook, so I wrote the following code
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
// add the app link
intent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details? id=com.phonelight.realparrot");
startActivity(Intent.createChooser(intent, "Share with Facebook"));
After sharing, I opened my Facebook account and saw the following:
As you can see, It should be an image in the right square. I am wondering how can I put that image, I am thinking to put my icon app
Like if you share a youtube link, the image will be the first shot of the movie.
Change intent.setType("text/plain");
to intent.setType("image/*");
then add intent.putExtra(Intent.EXTRA_STREAM, myImageContentUri);
I am having trouble when I try to pass a text string from within an EditText to either Facebook or Twitter via an intent. In fact, the only option which works currently is email.
The code I am using is below:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, textVariable.getText());
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject Title");
startActivity(Intent.createChooser(intent, "Share Text"));
I have tried it with and without the subject line. Any thoughts?
Thank you :)
To share the text on Facebook and Twitter the way you are using is not correct. You need to try out the other way of sharing.
Just refer Link it will guide you on how to share the text on facebook & twitter using intent.
The following code should do the trick!
try {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.twitter.android",
"com.twitter.applib.composer.TextFirstComposerActivity"));
intent.putExtra(Intent.EXTRA_TEXT, text);
context.startActivity(intent);
// Success!
} catch (Exception e) {
// official twitter code missing
}
Look Share bitmap with text on Twitter, Email & bitmap on Facebook in Android using Intent
You can share image with text caption on twitter but on facebook you can not share text caption using Intent, for that you have to use Facebook SDK.
I recently implemented the action-send intent to share a plain text. Facebook is installed and updated on my phone but only "Googlemail" and "Textmessage" are shown as options for sharing my text.
A short code snippet:
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, item.getTitle());
intent.putExtra(
android.content.Intent.EXTRA_TEXT,
(item.getDescription());
startActivity(Intent.createChooser(intent, "Send..."));
Any suggestions what's wrong with my app?
Normally I would think that I dont have to implement the whole facebook sdk for my simple purpose?!
Thanks in advance
The MIME type to use is text/plain, not plain/text.