-1

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: enter image description here

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?

Community
  • 1
  • 1
user274051
  • 325
  • 1
  • 12
  • Can anyone tell me why the question has been downgraded twice? I don't really understand. If it is so easy to answer the question, or you know the link for a question where it has been answered, just provide it, so other can benefit from it. Downgrading a question without providing a feedback is misleading for others and prevent the question to be answered. – user274051 Jan 24 '17 at 11:54

1 Answers1

1

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 :-)

Milind Mevada
  • 3,145
  • 1
  • 14
  • 22
  • Thanks mate. I really appreciate. So, Whatsapp its actually fetching the image itself when you set the type to "text/plain" and you provide the link. That's fantastic. ;) – user274051 Jan 24 '17 at 12:08