Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android摄像头意图保存文件两次/如何避免_Java_Android_Android Intent_Camera - Fatal编程技术网

Java Android摄像头意图保存文件两次/如何避免

Java Android摄像头意图保存文件两次/如何避免,java,android,android-intent,camera,Java,Android,Android Intent,Camera,我使用easy camera intent在Android中拍摄简单照片,如下所示: Uri outputFileUri = Uri.fromFile( photo ); Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); camera.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri ); this.startActivityForResult(camera, CAMERA_

我使用easy camera intent在Android中拍摄简单照片,如下所示:

Uri outputFileUri = Uri.fromFile( photo );
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
camera.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
this.startActivityForResult(camera, CAMERA_RESULT);
问题是:文件保存了两次

  • 照片实际拍摄完成后(然后保存到gallery目录)
  • 一旦用户“接受”图片(然后将其保存到outputFileUri)

虽然我真的无法想象这一事实,但我已经读到,创建这些重复文件是无法避免的但是如果没有,是否有可能获取gallery目录中的图片路径,以便通过我的应用程序将其删除?

只是想让你们知道,我做了一些研究,但事实上,像这样解决它并不是一个好主意-不幸的是

不过,您可以执行一项非常简单的SurfaceView摄像头活动,该活动只会保存您告诉它的数据