file permissions - How to check whether folder exist in external Storage in Android? -
string fldr= "main";
i need find whether there folder called fldr in anywhere in directory.
this return directory of external storage
string sdpath = environment.getexternalstoragedirectory().tostring();
if there folder similar fldr need directory , check whether writable.. how ?
do way,
file dir = new file(environment.getexternalstoragedirectory() + "/main"); if(dir.exists() && dir.isdirectory()) { // here } /** * @return true if external storage available. * false otherwise. */ public static boolean checkavailable() { // retrieving external storage state string state = environment.getexternalstoragestate(); // check if available if (environment.media_mounted.equals(state) || environment.media_mounted_read_only.equals(state)) { return true; } return false; } /** * @return true if external storage writable. * false otherwise. */ public static boolean checkwritable() { // retrieving external storage state string state = environment.getexternalstoragestate(); // check if writable if (environment.media_mounted.equals(state)) { return true; } return false; }
Comments
Post a Comment