6.13 CannonView Subclass of SurfaceView

Class CannonView (Figs. 6.196.33) is a custom subclass of View that implements the Cannon Game’s logic and draws game objects on the screen.

Fig. 6.33 Nested class CannonThread manages the game loop, updating the game elements every TIME_INTERVAL milliseconds

Code continues.

6.13.1 package and import Statements

Figure 6.19 lists the package statement and the import statements for class CannonView. Section 6.3 discussed the key new classes and interfaces that class CannonView uses. We’ve highlighted them in Fig. 6.19.

Fig. 6.19 CannonView class’s package and import statements

Get Android How to Program, 3/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.