I am making timer and I want to repeat it, for example, 6 times, but I don't know how to set delay and how to each time display me the countdown again on tv1. My code look like that. As you can see in code, I am using Handler method, but I don't know know if it's correct.
tv1=findViewById(R.id.textView);
btn1=findViewById(R.id.button);
final int x=10000;
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
timr =new CountDownTimer(x,1000) {
@Override
public void onTick(long millisUntilFinished) {
tv1.setText(""+millisUntilFinished/1000);
}
@Override
public void onFinish() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
}
})
}
}.start();
}
});