6.8. CannonView Subclass of View
Class CannonView
(Figs. 6.7–6.20) is a custom subclass of View
that implements the Cannon Game’s logic and draws game objects on the screen.
1 // CannonView.java 2 // Displays and controls the Cannon Game 3 package com.deitel.cannongame; 4 5 import android.app.Activity; 6 import android.app.AlertDialog; 7 import android.app.Dialog; 8 import android.app.DialogFragment; 9 import android.content.Context;10 import android.content.DialogInterface;11 import android.graphics.Canvas; 12 import android.graphics.Color; 13 import android.graphics.Paint; 14 import android.graphics.Point; 15 import android.media.AudioManager;16 import android.media.SoundPool; ...
Get Android™ How to Program, Second Edition 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.