I am using below code to fetch all videos from a specific folder.
String selection=MediaStore.Video.Media.DATA +" like?";
String[] selectionArgs = new String[]{folderPath};
return new CursorLoader(this, MediaStore.Video.Media.EXTERNAL_CONTENT_URI, COLUMNS_OF_INTEREST, selection, selectionArgs,
MediaStore.Video.Media.DATE_ADDED + " ASC");
But this doesn't work for programmatically created folders.How can I fetch all video files from a programmatically created folder?
This is probably happening since your device needs to scan for the changed files. You can do it like this.
MediaScannerConnection.scanFile(this,
new String[] { file.toString() }, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
//Do something
}
});