保存相机位图存储,并与位图图像设置 [英] Saving Camera Bitmap to Storage, and Setting Image with Bitmap
本文介绍了保存相机位图存储,并与位图图像设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何拍摄照片并将其设置为ImageView的基础。
I know the basics on how to take a picture and set it to ImageView.
photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
我想要做的比这多一点。
I want to do a little more than that.
我将其保存到一个文件夹到SD卡。我曾与这成功地做到:
I am saving it to a folder on to an SD card. That I have done successfully with this:
// intent
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(intent, CAMERA_REQUEST);
下面是我的下一个问题:
Here is my next question:
不知道如何做到这一点:我想下一步怎么做:下一次我来到了这个活动
,我想检查,如果该图像存在,并将其分配给的ImageView
。
Not sure how to do this: What I'd like to do next: The next time I come to this Activity
, I'd like to check if that image exists and assign it to that imageView
.
推荐答案
最近几天我在我的应用程序之一面临这个问题。
Last days i faced this issue in one of my applications.
我会试着在这里解释一下BITTE我做了什么。
I'll try here to explain a little bitte what i have done.
- 尝试将图片完整路径保存到存储区或您的共享preferences。
- 如果你打电话那么你的活动检查,如果图片已经存在,如果你可以用它下一次。
- prepare。
- 如果点(2)是假的,然后为了拍一张新照片切换到摄像机视图(SurfaceView)
在你的XML布局能见度=水涨船高,如果点(2)是真实的,那么你可以能见度变为可见,并在视图设置图像的ImageView的
这篇关于保存相机位图存储,并与位图图像设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文