public static Uri createFileUri(String path){
  if (path.startsWith("file://")) {
    return Uri.parse(path);
  }
  return Uri.fromFile(new File(path));
}

public static Uri createFileUri ( String path ) { if ( path . startsWith ( "file://" ) ) { return Uri . parse ( path ) ; } return Uri . fromFile ( new File ( path ) ) ; }
creates a file uri for a file defined by its absolute path . the method can handle the case of an absolute path ( e . g . / data / data . . . . ) and a uri path containing the file : / / scheme ( e . g . file : / / / data / data . . . )
