SAF(存盤訪問框架)有常量 DocumentsContract.Document.MIME_TYPE_DIR 這是這個字串:vnd.android.document/directory作為目錄的 MIME 型別。
MediaStore 有這樣的目錄嗎?
下面的查詢為 Logcat 中的檔案和目錄列印相應的 mime 型別和 null。
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))
}
}
是否有任何替代方法使用 MediaStore API來確定專案是檔案還是目錄?
uj5u.com熱心網友回復:
MediaStore 有這樣的目錄嗎?
不,對不起。
是否有任何替代方法使用 MediaStore API 來確定專案是檔案還是目錄?
MediaStore僅包含您所說的檔案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/440046.html
