[REFACTOR] Moved attachState() method to onResume(), placed
detachState() method to onPause().