Convert file: Uri to File in Android

What’s the easiest way to convert from an android.net.Uri object which holds a file: type to a File object in Android? I tried the following but it doesn’t work: File file = new File(Environment.getExternalStorageDirectory(), “read.me”); Uri uri = Uri.fromFile(file); File auxFile = new File(uri.toString()); assertEquals(file.getAbsolutePath(), auxFile.getAbsolutePath()); 23 s 23 What you want is… new File(uri.getPath()); … Read more