1

I am trying to write an image file to sd card but i get an error :Open Failed eacces permission denied.

i am using this code:

File ff = new File(aa.datasearchSG_getter().get(0).getUrl()+ "try" );
try{ 
    ff.createNewFile();
} catch (Exception e){ 
    Log.d("error" , "creating");
    e.printStackTrace(); 
}

I have added permission :-

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> and

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

but still getting error.

Yazan
  • 6,074
  • 1
  • 19
  • 33
Ankesh kumar Jaisansaria
  • 1,563
  • 4
  • 26
  • 44

1 Answers1

0

Finally I solved this issue. We need to get TreeUri using Android Storage Access Framework(SAF) and then using that Uri to modify the file.

Ankesh kumar Jaisansaria
  • 1,563
  • 4
  • 26
  • 44