i am having 2 activities right now, the first one contain a "start" button, and when user press start, it will go to the second activity by
Intent myIntent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(myIntent);
overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
and when the second activity starts, it automatically starts a CountDownTimer which i have
countDownTimer = new MalibuCountDownTimer(startTime, interval);
countDownTimer.start();
inside OnCreate of the second activity. Currectly startTime is 20 second, and I have it displayed onto a textview with this
text.setText(""+String.format("%02d:%02d:%03d",
TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(millisUntilFinished)),
TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished)),
TimeUnit.MILLISECONDS.toMillis(millisUntilFinished) - TimeUnit.SECONDS.toMillis(TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished))
));
However, when the second activity starts, the time would show something like
00:19:674
something like that, like it would never starts at 00:20:000, is there a way to fix this problem?
Thanks