如何分享从我的应用程序,图像,WhatsApp的? [英] how to share images from my app to whatsapp?
本文介绍了如何分享从我的应用程序,图像,WhatsApp的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面我分享图片从我的应用程序whatsapp.but这个code为在这里工作只为mylist1 [我],并没有为mylist2 [i]和mylist3 [1]。正如我在活动文件中有每列表15幅图像。怎么办?
意向意图=新的意图();
intent.setAction(Intent.ACTION_SEND);
intent.setType(图像/ *);
开放的我们的uri = Uri.parse(android.resource://com.example.drawcelebrities/+ mylist1 [I] + mylist2 [I] + mylist3 [I]);
intent.putExtra(Intent.EXTRA_STREAM,URI);
startActivity(Intent.createChooser(意向,共享通过));
解决方案
取图像阵列在mylist中[]并使用下面code,然后通过WhatsApp的分享图像。
开放的URI = Uri.parse(android.resource://+ getPackageName()+/+ mylist中[I]);
意图shareIntent =新意图();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType(图像/ *);
shareIntent.putExtra(Intent.EXTRA_STREAM,URI);
startActivity(Intent.createChooser(shareIntent,通过分享));
Here i am sharing images from my app to whatsapp.but this code is working here only for mylist1[i] and not for mylist2[i] and mylist3[i]. As in my activity file there are 15 images in every list. what to do?
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/*");
Uri uri = Uri.parse("android.resource://com.example.drawcelebrities/"+mylist1[i]+mylist2[i]+mylist3[i]);
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Share via"));
解决方案
Take image array in mylist[] and use below code, then share image via whatsapp.
Uri uri = Uri.parse("android.resource://"+getPackageName()+"/"+mylist[i]);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(shareIntent, "Share via"));
这篇关于如何分享从我的应用程序,图像,WhatsApp的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文