Search code examples
androidandroid-sdcardread-write

Android read/write permission of a folder


I am doing a new android app. I want to create a folder in "Android" folder which is available in sdcard. Before that I want to check whether the folder has read/write permission. How can I get that? can anyone help me to do this.


Solution

  • You do it the old-school java way. Create a file object and call canWrite() and canRead().

    File f = new File("path/to/dir/or/file");
    if(f.canWrite()) {
        // hell yeah :)
    }