0
我想通过shareIntent
分享图片。我下面的代码给出:无法在Gmail和Instagram中共享图片
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(list.get(position).getFilePath()));
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sending from myApp");//gmail-subject
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Image 1234");//gmail-body
shareIntent.putExtra(Intent.EXTRA_TITLE, "Image 1234");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "Share via"));
我能够发送图像WhatsApp的和Facebook的但不是在的Gmail或Instagram的。
当试图通过的Gmail分享它显示我
Can't attach file
和Instagram的它显示我
无法加载图像
。
是否需要添加任何其他内容shareIntent
?
这工作得很好。但有1个问题:share.setType(fileExtension +“/ *”);由于这一行,它向我展示了与share.setType(“image/*”)相比较的可共享应用程序的小列表。 – Kesha
只能使用图像 –
也是答案的正确答案 –