【发布时间】:2015-10-14 18:58:56
【问题描述】:
我在使用 Intent 共享图像时遇到了一个小问题。这是我的情况,当我使用以下代码时,我想分享带有标题的图像(标题可能是链接或文本)
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.setType("image/*");
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.whatsapp_promotion);
ByteArrayOutputStream os = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, os);
String path = MediaStore.Images.Media.insertImage(
getContentResolver(), bitmap, null, null);
Uri uri = Uri.parse(path);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent
.putExtra(
Intent.EXTRA_TEXT,
"**my message with URL **");
startActivity(Intent.createChooser(shareIntent, "Share Via..."));
我可以与 hangout、whatsapp、twitter 等分享,但无法与 facebook 分享。所以我决定的是一张带有标题的图片,可以在whatsapp、hangout、facebook等中分享,
怎么做,请帮帮我
提前致谢
【问题讨论】: