2015-03-02 50 views
2

我正在开发一个Android应用程序,用于从Url获​​取图片。我必须在Google+上分享多个图片。一个图像工作正常。请建议。 我正在使用下面的代码和平。有没有什么办法可以在谷歌加多张图片上使用ACTION_SEND

Intent shareIntent = new Intent(Intent.ACTION_SEND); 
         shareIntent.putExtra(Intent.EXTRA_SUBJECT, curentWit.getWit_name()); 
         shareIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(shrd).toString()); 
         if(isInLine == 1) 
         { 
          shareIntent.putExtra(Intent.EXTRA_STREAM, uris.get(0)); 
         } 
         shareIntent.setType("text/plain"); 
startActivity(shareIntent); 

回答

1

我不知道GooglePlus是否允许您同时发送多个图像。但是,如果您想同时发送多个图像(假设您正在发送电子邮件),那么您应该使用Intent.ACTION_SEND_MULTIPLE而不是Intent.ACTION_SEND

这就是我通过电子邮件发送多个图像的方式。

Intent shareIntent = null; 

if(uris.size > 1) { 
    shareIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); 
    shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); 
} 
else { 
    if (uris.size() == 1) { 
     shareIntent = new Intent(Intent.ACTION_SEND); 
     shareIntent.putExtra(Intent.EXTRA_STREAM, uris.get(0)); 
    } 
} 
shareIntent.setType("image/*"); 
shareIntent.putExtra(Intent.EXTRA_SUBJECT, curentWit.getWit_name()); 
shareIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(shrd).toString()); 

startActivity(shareIntent); 
+0

非常感谢Apurva,它的作用像魅力。 – 2015-03-03 11:35:37

+0

Apurva关于gridview的更多问题我们可以根据列的宽度自定义gridview自定义gridview – 2015-03-04 06:21:13

+0

@VinayakMishra是的,你可以调整gridview列的宽度。 – Apurva 2015-03-04 06:23:13

相关问题