简体   繁体   English

Android拍照并保存到变量

[英]Android Take Photo and Save to Variable

I would like to allow the user to take a photo, and when finished, have it passed directly into a variable (Bitmap preferably) instead of saved to memory. 我想允许用户拍照,完成后直接将其传递到变量(最好是位图)中,而不是保存到内存中。 I've tried using the default android camera intent but cannot seem to stop it from saving to memory and showing up in the gallery. 我尝试使用默认的Android相机意图,但似乎无法阻止它保存到内存并显示在图库中。

Any suggestions? 有什么建议么?

What I have so far is this: 我到目前为止所拥有的是:

Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
    startActivityForResult(takePictureIntent, 1);
}

But this saves the picture in the gallery. 但这会将图片保存在图库中。 I would like to get the image without saving it in the gallery. 我想获取图像而不将其保存在图库中。

Here's a nice example given at official android developer site: http://developer.android.com/training/camera/photobasics.html 这是官方android开发人员网站上给出的一个很好的示例: http : //developer.android.com/training/camera/photobasics.html

Hope this would be helpful. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM