I'm having a problem with the below code on Samsung phones running Android 10. The code should get the recorded videos and display them on the My Videos screen of the app. The code does not work on Samsungs phones running Android 10. The screenshot below shows what the code displays on phones that are not Samsung running Android 10. On Samsung phones running Android 10 the list view is blank. Any ideas?
private void getLegalVideos() {
File legalDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES), IMAGE_DIRECTORY_NAME);
String pattern = ".mp4";
//Get the listfile of that folder
final File[] listFile = legalDir.listFiles();
if (listFile != null) {
for (File file : listFile) {
if (!file.isDirectory()) {
if (file.getName().endsWith(pattern)) {
// Do what ever u want, add the path of the video to the list
Log.d(TAG, file.getAbsolutePath());
mLegalVideos.add(new VideoItem(file.getName(), file.getAbsolutePath()));
}
}
}
}
}