Send Image and Text both using ACTION_SEND or ACTION_SEND_MULTIPLE

房东的猫 提交于 2020-01-14 12:21:11

问题


- 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.



来源:https://stackoverflow.com/questions/18357872/send-image-and-text-both-using-action-send-or-action-send-multiple

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!