2013-01-05 196 views
0

我在android中捕獲圖像。在圖片中的回調函數我已保存的圖像 這裏是我保存代碼相機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

嘗試呼叫相機活動之前添加此代碼,

 Uri uriSavedImage=Uri.fromFile(new File("/sdcard/picturename.png")); 
    camera.putExtra("output", uriSavedImage); 
    startActivityForResult(camera, 1); 
+0

我用相機作爲服務 –

相關問題