0

我正在尝试遵循本教程:http: //mobile.tutsplus.com/tutorials/android/capture-and-crop-an-image-with-the-device-camera/

但是,拍照后,当图片要被裁剪时,会出现“正在加载图像......”永远。

我试过敬酒“picUri = data.getData();” 它返回空值。我读过在某些设备中我们需要为要拍摄的照片指定文件名,所以我尝试了,但没有好的结果。

Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, "file:///tmp/android.jpg");
                startActivityForResult(captureIntent, CAMERA_CAPTURE);

我正在 Galaxy Nexus 和 Galaxy 5 上测试它。

有人知道吗?

谢谢你。

4

1 回答 1

0

我认为您提供给 EXTRA_OUTPUT 的文件路径是错误的。而是尝试使用这样的东西:

Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
String storagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmp/android.jpg";
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, storagePath);
startActivityForResult(captureIntent, CAMERA_CAPTURE);
于 2012-09-27T20:44:25.373 回答