Send Image and Text both using ACTION_SEND or ACTI

2019-06-25 23:41发布

问题:

- We have tried to post image and text using the below code:

final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
shareIntent.setType("image/png");
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/UserImages/"+ ParseUser.getCurrentUser().getObjectId() + ".png"));
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Hello test");
startActivity(Intent.createChooser(shareIntent,"Share"));

- We have also tried using shareIntent.setType("*/*"), but still no luck.

- When we are trying to post this on email, only text is appearing in it, and when we tried posting it on whatsapp then only the image was visible.

- We are unable to post both together, can anyone suggest the proper way of doing it.

Thank you very much in advance.

回答1:

Now your code gonna work due the new updates to whatsapp, before this didn't accept this kind of intent (ACTION_SEND_MULTIPLE) because it accepts only one file at a time.