Android 使用数据URI方案发送位图
我正在尝试解决此问题的另一种方法: 我的想法是将PNG编码到。我的代码:Android 使用数据URI方案发送位图,android,Android,我正在尝试解决此问题的另一种方法: 我的想法是将PNG编码到。我的代码: ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write("data:image/png;base64,".getBytes()); Base64OutputStream base64 = new Base64OutputStream(baos, Base64.NO_WRAP); boolean ok = bitmap.compress(Bit
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write("data:image/png;base64,".getBytes());
Base64OutputStream base64 = new Base64OutputStream(baos, Base64.NO_WRAP);
boolean ok = bitmap.compress(Bitmap.CompressFormat.PNG, 0, base64);
base64.close();
if (ok) {
Uri uri = Uri.parse(baos.toString());
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/png");
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(intent);
}
我尝试过的应用程序,比如Android 4.4.4上的Gmail,都说它们无法打开图像。
我是否正确创建Uri?如果是,是什么阻止其他应用程序读取我的图像
我是否正确创建Uri
我不知道
如果是,是什么阻止其他应用程序读取我的图像
因为他们不知道如何处理数据Uri