8
将文件路径额外添加到图像捕获目标会导致相机应用在TF300t Android平板电脑上使用股票系统版本4.2.1发生故障。按“完成”按钮什么都不做 - 甚至不关闭相机应用程序活动。没有结果返回。“简单地”拍照不起作用
我正在使用的代码是从Adroid developers site
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
File imageFile = createImageFile();
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
startActivityForResult(cameraIntent, THIS_CAMERA_REQUEST);
萃取createImageFile()所定义:
private File createImageFile() throws IOException {
File outputDir = getBaseContext().getCacheDir();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "photo_" + timeStamp + "_";
File image = new File(outputDir, imageFileName);
return image;
}
当线
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
被移除时,照相机应用程序按预期行事。
是否有任何合理的解决方法?我宁愿自己不建立一个相机应用程序来拍照。
出现同样的问题。非常具有欺骗性的错误信息。我正试图将照片直接保存到我的应用程序的私人存储空间中,这是一个禁忌。感谢您的发布。 – 2014-03-16 23:31:10