There is a countdown timer for 10 seconds, after the expiration of time a new activity opens, but when the device rotates, the timer is reset, trying to save the seconds value to int and use onSaveInstanceState (), but nothing happened (And I need the application to be able to turn) , Help me to understand! Here is the code:
public void startTimer() { cTimer = new CountDownTimer(10000, 1000) { public void onTick(long millisUntilFinished) { mTimer.setText("" + millisUntilFinished / 1000); } public void onFinish() { mTimer.setText("done!"); Intent intent = new Intent(MainActivity.this, MainActivity2.class); /*Здесь реализация*/ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }; cTimer.start(); } public void cancelTimer() { if(cTimer!=null) cTimer.cancel(); }