Could you please support me to set up properly progressbar, according to my existing code progressbar is not going during search process, it just showing me full bar when search will be finished.
int count = 0;
int forProgressbar = 0;
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < new content().text.length; i++) {
Pattern pattern = Pattern.compile(editText.getText().toString());
Matcher matcher = pattern.matcher(new content().text[i]);
while (matcher.find()) {
count++;
forProgressbar = i;
}
}
new Thread(() -> {
hdlr.post(() -> progressBar.setProgress(forProgressbar));
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
textView.setText("~" + editText.getText().toString() + "~" + count);
count = 0;
}
});