java - Permission to write to the SD card -


I would like to store my app DB in an SD card. In my code, I check whether the directory canwrite () is present, and if not, throw IOException in this particular example, I will send the DB file to the root directory on the SD card I'm trying to copy, but it's throwing a IOException . How can I change the permissions of a folder / file to be able to write it?

Again, the SD card's directory is / sdcard but you It should not be difficult coding. Instead, call to get the directory:

  file sdDir = Environment.getExternalStorageDirectory ();  

If you have not already done so, then you have to give your app the correct permission to write on the SD card by adding the line below your manifest:

 < Code> & lt; Usage-permission Android: name = "android.permission.WRITE_EXTERNAL_STORAGE" />  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -