I'm making a query on the Android's MediaStore Files Database -MediaStore.Files.getContentUri("external")
- and, for some specific folders, both the MediaStore.MediaColumns.TITLE
, and MediaStore.MediaColumns.DISPLAY_NAME
are null while for other folders this value exists.
I couldn't find any documentation about MediaStore.MediaColumns.TITLE being possibly null.
This happens for a few internal Android directories, such as these:
_data: /storage/emulated/0/Music, title: null, _display_name: null
_data: /storage/emulated/0/Notifications, title: null, _display_name: null
_data: /storage/emulated/0/Pictures, title: null, _display_name: null
However, for some other folders, the title is there:
_data: /storage/emulated/0/Android, title: Android, _display_name: null
_data: /storage/emulated/0/DCIM, title: DCIM, _display_name: null
_data: /storage/emulated/0/Download, title: Download, _display_name: null
All data comes directly from the MediaStore query.
I am aware I could work directly with the Data but I'm trying to sort the query according to the TITLE, which leads to incorrect results given that some are null.
Is this an expected behaviour? How to deal with it and retrieve all files correctly sorted by title?
MediaStore.Files.getContentUri("external");
– Pietro