Upon expiration of the timer, the user should automatically return to the ResultActivity ( ResultActivity for example). Here is the code

 @Override public void onFinish() { times.setText("Время вышло"); } @Override public void onTick(long millisUntilFinished) { // TODO Auto-generated method stub long millis = millisUntilFinished; String hms = String.format( "%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis), TimeUnit.MILLISECONDS.toMinutes(millis) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS .toHours(millis)), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS .toMinutes(millis))); System.out.println(hms); times.setText(hms); } 
  • one
    where should he return from? - pavlofff
  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

I understand you are working with countdowntimer. At the end of the counter will work

 onFinish() 

Add there logic or return:

 public void onFinish() { times.setText("Время вышло"); onBackPressed(); } 

Or so:

 public void onFinish() { times.setText("Время вышло"); Intent intent = new Intent(getApplicationContext(), ResultActivity.class); startActivity(intent); }