January 2014
Intermediate to advanced
736 pages
70h 43m
English
Figure 6.18 implements the surfaceChanged, surfaceCreated and surfaceDestroyed methods of interface SurfaceHolder.Callback. Method surfaceChanged has an empty body in this app because the app is always displayed in portrait orientation. This method is called when the SurfaceView’s size or orientation changes, and would typically be used to redisplay graphics based on those changes. Method surfaceCreated (lines 485–494) is called when the SurfaceView is created—e.g., when the app first loads or when it resumes from the background. We use surfaceCreated to create and start the CannonThread to begin the game loop. Method surfaceDestroyed (lines 497–515) is called when the SurfaceView is destroyed—e.g., ...
Read now
Unlock full access