Problems saving a photo to a file

前端 未结 4 678
野趣味
野趣味 2020-12-13 16:50

Man, I am still not able to save a picture when I send an intent asking for a photo to be taken. Here\'s what I am doing:

  1. Make a URI representing

4条回答
  •  鱼传尺愫
    2020-12-13 17:05

    As Steve said, you should save your picture in your SD card. The directory where you are trying to save is private and unless you have your device rooted you will can't write there. Try replace this line:

    String fname = c.getFilesDir().getAbsolutePath()+"/parked.jpg";
    

    with this line

    String fname = Environment.getExternalStorageDirectory().getAbsolutePath() + "somePathYouKnownExists" + +"/parked.jpg";
    

    This should be enough.

提交回复
热议问题