Code example for ActionBarActivity

Methods: onPause

0
     
    // onPause is always called when the activity is undisplayed 
    // stop the counter thread here 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        hiitRunner.pauseRunner();    // tell it to pause
        hiitRunner.interrupt();        // cancel the current timeout, if any
        // if there isn't a timeout, the exception will be raised without harm inside hangThread() 
 
        // just after we stop executing, release the screen lock 
        if (scrUnLock.isHeld()) scrUnLock.release();
    } 
     
    @Override protected void onDestroy() { 
        super.onDestroy(); 
 
        // if we're here, that means we've already paused the Runner thread 
        // thus, we set the flag for it to die and then pull it out of wait() so it returns 
        hiitRunner.resumeRunner();    // should not be necessary, but make sure it does not hang again
        hiitRunner.stopRunner();    // next time through any loop it will see this and kill itself