Reputation: 862
In some rare situations, MediaStore
returns null
when trying to query for MediaStore.Video.VideoColumns.DISPLAY_NAME
using the following code snippet
String displayName = cursor.getString(cursor.getColumnIndex(MediaStore.Video.VideoColumns.DISPLAY_NAME));
I guess it might be related to a file name, since it is only reported on a few devies. However I assume that file display names can't be null, so it is a bit weird that MediaStore
returns null
. Has anybody experienced a similar problem?
Upvotes: 1
Views: 2150
Reputation: 3841
We have the same problem on one device.
If the DISPLAY_NAME is null the TITLE can be used.
String displayName = cursor.getString(cursor.getColumnIndex(MediaStore.Video.VideoColumns.DISPLAY_NAME));
if (displayName == null) {
displayName = cursor.getString(cursor.getColumnIndex(MediaStore.Video.VideoColumns.TITLE));
}
Upvotes: 3