문제

I have a countdown timer, When it reaches 00:00 I wish to start a new activity. However the app crashes when the timer reaches 00:00. I tried using the same way to start an activity as I do with buttons and they work but not on timer end.

public class MyCount extends CountDownTimer 
{
    Context mContext;

    public MyCount(long millisInFuture, long countDownInterval) 
    {
        super(millisInFuture, countDownInterval);
    }


    public void onTick (long millisUntilFinished) 
    {
        gameTimer.setText ( formatTime(millisUntilFinished));
    }

    public void onFinish() {
        counter.cancel();
        startActivity(new Intent(Game.this, EndGame.class));
    }

}    
도움이 되었습니까?

해결책

Make sure that your activity is listed under Manifest file and if possible then paste the stacktrace, this will give the clear view of the issue.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top