For some reason my cursor in android will not return any video files that are in the folder I'm searching through. If I do minor changes to the code and search for Images instead. The cursor returns all images correctly, so only when I try searching for the videos the issue appears. Result is count = 0, even though there are several videos in the folder.
I would be greatful for any help I can get.
This is the code snippet I'm using:
...
String[] columns = { MediaStore.Video.Media.DATA };
String uri = MediaStore.Video.Media.DATA;
path = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES),
"MyCameraApp");
String condition = uri + " like '%" + path.toString() + "%'";
cursor = getContentResolver().query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
columns,
condition,
null //selection args,
null //orderBy);
count = cursor.getCount();
...
Turned out i needed to update the Mediastore to get the latest videos to appear when searching through the MediaStore For an example see Answer by Jake Basile