I have a directory that is displayed in a ListView. Inside each folder there is a .txt file called Sales ...(Sales112855,Sales122921,Sales122941, ..., ).
There is a cat for sorting through files. That is, by clicking on an item from the list, it goes inside the folder and goes through the files there.
The code:
File[] listFile = dir.listFiles();
for (File f : listFile) {
if (f.isDirectory() && (!f.getAbsolutePath().equalsIgnoreCase(String.valueOf(dir)))) {
File[] listFile2 = f.listFiles();
for (File f2 : listFile2) {
Toast.makeText(this, "f2 " + f2, Toast.LENGTH_SHORT).show();
}
Toast.makeText(this, "f " + f, Toast.LENGTH_SHORT).show();
}
}
Problems like this. I do not know how to make it stop at the file I need. tricks for JDK 8+ I will not be able to use.