private static boolean isWritable(@NonNull final File file){
  boolean isExisting=file.exists();
  try {
    FileOutputStream output=new FileOutputStream(file,true);
    try {
      output.close();
    }
 catch (    IOException e) {
    }
  }
 catch (  java.io.FileNotFoundException e) {
    return false;
  }
  boolean result=file.canWrite();
  if (!isExisting) {
    file.delete();
  }
  return result;
}

private static boolean isWritable ( @ NonNull final File file ) { boolean isExisting = file . exists ( ) ; try { FileOutputStream output = new FileOutputStream ( file , true ) ; try { output . close ( ) ; } catch ( IOException e ) { } } catch ( java . io . FileNotFoundException e ) { return false ; } boolean result = file . canWrite ( ) ; if ( ! isExisting ) { file . delete ( ) ; } return result ; }
check is a file is writable . detects write issues on external sd card .
