I have an error in:
for (int i = 0; i <listfiles.length; i ++) {
I do not understand it because, if I already have all the permissions.
public static ArrayList<String> getFilePaths(String directory){
ArrayList<String> pathArray = new ArrayList<>();
File file = new File(directory);
File[] listfiles = file.listFiles();
for(int i = 0; i < listfiles.length; i++){
if(listfiles[i].isFile()){
pathArray.add(listfiles[i].getAbsolutePath());
}
}
return pathArray;
}
Permission
Checking if the permits have been obtained.
Error: java.lang.NullPointerException: Attempt to get length of null array