i hope you are fine. i'm trying to make a progressBar increment while deleting multiple files in path, but the progressBar do not increase until it get the max directly, whats the problem, where i'm wrong ??
the Max of Progress Bar is listString of paths size that is 95 file, and the progress is the increment of counter, i hope you help me
this is my code im using :
FileUtil.listDir("/storage/emulated/0/Alarms/", listStr);
progressBar.setMax((int)listStr.size());
for(int i = 0; i < (int)(listStr.size()); i++) {
if (FileUtil.isFile(listStr.get((int)(i)))) {
FileUtil.deleteFile(listStr.get((int)(i)));
}
new Thread(new Runnable() {
@Override
public void run() {
progressBar.setProgress((int)i);
}
}).start();
}