我正在尝试使用标准 Intent 来拍照,然后允许批准或重拍。然后我想把图片保存到文件中。
这是我正在使用的 Intent:
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
startActivityForResult( intent, 22 );
The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT.
我没有传递额外的输出,我希望在传入onActivityResult()
的Intent的extra字段中得到一个Bitmap对象(对于这个请求)。那么你在哪里/如何提取它? Intent 有一个 getExtras()
,但它返回一个 Bundle,而 Bundle 需要一个 key 字符串来给你一些东西。
您在 Intent 上调用什么来提取位图?
最佳答案
尝试调用 getExtras().get("data")
并将结果转换为 Bitmap
。
关于android - 如何将图片保存到文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2451442/