我正在尝试分享图像和文字。当我这样做时:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
screenshot.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
File f = new File(Environment.getExternalStorageDirectory()
+ File.separator + "temporary_file.jpg");
try {
f.createNewFile();
FileOutputStream fo = new FileOutputStream(f);
fo.write(bytes.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file:///sdcard/temporary_file.jpg"));
share.putExtra(android.content.Intent.EXTRA_TEXT, textToShare);
startActivityForResult(Intent.createChooser(share, "Share Image"),
FROM_SHARE);
它适用于除 facebook 之外的所有应用程序(从 Gmail 等弹出对话框中选择),facebook 仅获取图像而不获取文本。有没有办法将带有图像的额外文本传递给 facebook 应用程序?谢谢!