Why is a MediaStore file's parent not a directory?

26 views Asked by At

Some video files (*.mp4) were created with MediaStore and they work perfectly. The Uri of a file is retrieved with ContentResolver query.

  • Uri: content://media/external/video/media/74
  • DISPLAY_NAME: foo.mp4

A file is created with the Uri as follows:

File file = new File(uri.getPath());
  • file.getAbsolutePath(): /external/video/media/74

  • file.getName(): 74

  • file.getParentFile(): /external/video/media

  • file.getParentFile().isDirectory(): false

  • file.getParentFile().list(): null

Could anyone shed some light on why file.getParentFile() (/external/video/media) is not a directory? Is there a way to get all the files and folders under "/external/video/media" without resorting to ContentResolver query?

0

There are 0 answers