hello, community I'm new in Stackoverflow, but many times I used it to find solutions to my questions (usually in Delphi). Today I'm new in Android Studio. I try to get the list files in an Android device using this code, from here: How to list files in an android directory?
String path = Environment.getExternalStorageDirectory().toString()+"/Pictures";
Log.d("Files", "Path: " + path);
File directory = new File(path);
File[] files = directory.listFiles();
Log.d("Files", "Size: "+ files.length);
for (int i = 0; i < files.length; i++)
{
Log.d("Files", "FileName:" + files[i].getName());
}
Apparently, it works, but I get only a Thumbnails file from /storage/emulated/0/Pictures but in the real folder from the device (MainStorage/Pictures) there are some Image files. I found this path using the App "File Manager +". I don't refer to a collection of images scattered in different folders. There are no more folders named 'Pictures' in the whole device. I know probably I do some basic things wrong but my inexperience in Android prevents me from discovering what it is. The device works in Android 11, but the minimum requirements for the project are Android 6
In advance, thank you very much.