7. Cannon Game App: Listening for Touches and Gestures, Manual Frame-By-Frame Animation, Graphics, Sound, Threading, SurfaceView and SurfaceHolder

Image

Objectives

In this chapter you’ll:

• Create a simple game app that’s easy to code and fun to play.

• Create a custom SurfaceView subclass and use it to display the game’s graphics from a separate thread of execution.

• Draw graphics using Paints and a Canvas.

• Override Activity’s onTouchEvent to process touch events when the user touches the screen or drags a finger on the screen.

• Use a GestureDetector to recognize more sophisticated user touch motions, such as double taps.

• Perform simple collision ...

Get Android™ for Programmers: An App-Driven Approach 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.