Home > front end >  What is the MediaStore MIME Type for Directory?
What is the MediaStore MIME Type for Directory?

Time:03-06

SAF(Storage Access Framework) have the constant DocumentsContract.Document.MIME_TYPE_DIR Which is this string: vnd.android.document/directory as MIME Type for the directory.
MediaStore have anything like this for directory?

Below query print corresponding mime type for files and null for directories in Logcat.

val uri = MediaStore.Files.getContentUri("external_primary")
val projection = arrayOf(MediaStore.Files.FileColumns.MIME_TYPE)
val cursor = contentResolver.query(uri, projection, null, null, null)

if (cursor != null) {
       while (cursor.moveToNext()) {
            Log.e("MIME TYPE", "mime type = "   cursor.getString(0))
       }
}

Is there any alternate way using MediaStore API to determine whether the item is a file or directory ?

CodePudding user response:

MediaStore have anything like this for directory?

No, sorry.

Is there any alternate way using MediaStore API to determine whether the item is a file or directory ?

MediaStore only contains what you refer to as files.

  • Related