How to continue the timeline onStop(),onPause()



  • When it comes out of the annex, but without shutting it down can the time counter continue?

    private Timer timer;
    private int second = 0;
    private int minute = 0;
    private int hour = 0;
    private TimerTask timerTask ;
       final Handler handler = new Handler();
       timer = new Timer(false);           
       timerTask = new TimerTask() {             
        public void run() {
        handler.post(new Runnable() {
              @Override
                  public void run() {                    
                  second++;
                  if(second == 60){
                   minute++;
                   second=0;
                   }else if(minute==60){
                   hour++;
                   minute=0;
                   }else if(hour==24){
                   hour=0;
                   }
    
    }
    

    });
    }
    };
    timer.schedule(timerTask, 1000,1000);



  • You've got to do your job in the service. Service performance does not depend on the life cycle of activism.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2