如何分享从我的应用程序,图像,WhatsApp的?我的、应用程序、图像、WhatsApp

由网友(随遇而安╰所谓旳无所谓)分享简介:下面我分享图片从我的应用程序whatsapp.but这个code为在这里工作只为mylist1 [我],并没有为mylist2 [i]和mylist3 [1]。正如我在活动文件中有每列表15幅图像。怎么办?意向意图=新的意图();intent.setAction(Intent.ACTION_SEND);intent...

下面我分享图片从我的应用程序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,通过分享));
 
Facebook Instagram还不够,扒一扒海外留学生手机必备APP

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"));

阅读全文

相关推荐

最新文章