android - CountDownTimer inside fragment: manage pause and resume fragment -


i have fragment countdowntimer object , pause timer when fragment goes in background, resume when fragment comes again foreground. code:

@override public void onpause() {     super.onpause();     active = false;     try {         synchronized (countdowntimer) {             countdowntimer.wait();             log.i("timer", "wait");         }     } catch (interruptedexception e) {         // todo auto-generated catch block         e.printstacktrace();     } }  @override public void onresume() {     super.onresume();     if (countdowntimer != null) {         countdowntimer.notifyall();         log.i("timer", "notify");     } } 

in way, timer stops countdown when put fragment background, don't restart when recall foreground. what's wrong?


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -