diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 1877868b1..0012b1a06 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -50,12 +50,13 @@ fun Context.launchSettings() { fun Context.getParents(): ArrayList { val uri = MediaStore.Files.getContentUri("external") - val columns = arrayOf(MediaStore.Images.Media.DATA) + val columns = arrayOf(MediaStore.Files.FileColumns.PARENT, MediaStore.Images.Media.DATA) + val where = "${MediaStore.Images.Media.DATA} IS NOT NULL) GROUP BY (${MediaStore.Files.FileColumns.PARENT} " val parentsSet = HashSet() var cursor: Cursor? = null try { - cursor = contentResolver.query(uri, columns, null, null, null) + cursor = contentResolver.query(uri, columns, where, null, null) if (cursor?.moveToFirst() == true) { do { val curPath = cursor.getStringValue(MediaStore.Images.Media.DATA) ?: continue