January 2014
Intermediate to advanced
736 pages
70h 43m
English
Class CannonGameFragment’s onPause and onDestroy methods (Section 6.7) call class CannonView’s stopGame and releaseResources methods (Fig. 6.17), respectively. Method stopGame (lines 464–468) is called from the main Activity to stop the game when the Activity’s onPause method is called—for simplicity, we don’t store the game’s state in this example. Method releaseResources (lines 471–475) calls the SoundPool’s release method to release the resources associated with the SoundPool.
463 // stops the game; called by CannonGameFragment's onPause method464 public void stopGame()465 {466 if (cannonThread != null)467 cannonThread.setRunning( ...
Read now
Unlock full access