0

我正在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)

帮帮我

4

1 回答 1

0

尝试在调用相机活动之前添加此代码,

     Uri uriSavedImage=Uri.fromFile(new File("/sdcard/picturename.png"));
     camera.putExtra("output", uriSavedImage);
     startActivityForResult(camera, 1);
于 2013-01-05T23:17:32.187 回答