我在android中捕获图像。在图片回调功能中,我保存了图像 这是我的保存代码
String number = Integer.toString(image_number);
Log.e("pathhhhhhhhhhhhhhh", "/sdcard/img-"+number+".jpg");
outStream = new FileOutputStream("/sdcard/img-"+number+".jpg");
Log.e("image number", Integer.toString(image_number));
image_number++;
outStream.write(data);
outStream.close();
} catch (FileNotFoundException e){
Log.d("CAMERA", e.getMessage());
} catch (IOException e){
Log.d("CAMERA", e.getMessage());
}
它适用于2.2模拟器但是当我在模拟器3.0中运行时它显示错误
这是错误
01-06 04:55:47.398: ERROR/pathhhhhhhhhhhhhhh(424): /sdcard/img-0.jpg
01-06 04:55:47.398: DEBUG/CAMERA(424): /sdcard/img-0.jpg (Permission denied)
帮帮我
答案 0 :(得分:0)
尝试在调用相机活动之前添加此代码,
Uri uriSavedImage=Uri.fromFile(new File("/sdcard/picturename.png"));
camera.putExtra("output", uriSavedImage);
startActivityForResult(camera, 1);