Before Android 7.0, i was able to get list of files under "/"
directory, but on Andorid 7.0 version i am getting null when i try t get list of files from "/"
directory.
Below is my code:
File root = new File("/");
File[] files = root.listFiles();
From android 7.0 they have applied more restrictions. Now you need to get access for individual directories.
Check this link out for more information.
I was facing a similar issue with Android 7.0. Try using "/storage/emulated/0" instead of "/". You should get all the files in your phone storage.
You can also use
Environment.getExternalStorageDirectory().getAbsolutePath()
Use Environment.getRootDirectory()
replace it!