Метод OnCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playing);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
circularViewWithTimer = findViewById(R.id.circular_view);
CircularView.OptionsBuilder builderWithTimer =
new CircularView.OptionsBuilder()
.shouldDisplayText(true)
.setCounterInSeconds(30)
.setCircularViewCallback(new CircularViewCallback() {
@Override
public void onTimerFinish() {
resetTimer();
showQuestion(++index);
}
@Override
public void onTimerCancelled() {
}
});
circularViewWithTimer.setOptions(builderWithTimer);
txtScore = findViewById(R.id.txtScore);
txtQuestionNum = findViewById(R.id.txtTotalQuestion);
question_text = findViewById(R.id.question_text);
question_image = findViewById(R.id.question_image);
progressBar = findViewById(R.id.progressBar);
btnA = findViewById(R.id.btnAnswerA);
btnB = findViewById(R.id.btnAnswerB);
btnC = findViewById(R.id.btnAnswerC);
btnD = findViewById(R.id.btnAnswerD);
btnA.setOnClickListener(this);
btnB.setOnClickListener(this);
btnC.setOnClickListener(this);
btnD.setOnClickListener(this);
}
Метод ResetTimer
private void resetTimer() {
CircularView.OptionsBuilder builderWithTimer =
new CircularView.OptionsBuilder()
.shouldDisplayText(true)
.setCounterInSeconds(30)
.setCircularViewCallback(new CircularViewCallback() {
@Override
public void onTimerFinish() {
}
@Override
public void onTimerCancelled() {
}
});
circularViewWithTimer.setOptions(builderWithTimer);
}
Таймер не запускается снова на финише Я пробовал вышеуказанный код