Answers to Self-Review Exercises

7.1

a) SensorEventListener.

b) curves.

c) dragged across the screen.

d) unregisterListener.

e) onSensorChanged.

f) onAttach.

g) onDraw.

h) getActionMasked.

i) immersive mode.

7.2

a) False. You unregister the accelerometer event handler when the app is sent to the background.

b) False. Call the inherited View method invalidate to indicate that the View needs to be redrawn.

c) False. If the action is MotionEvent.ACTION_DOWN or MotionEvent.ACTION_POINTER_DOWN, the user touched the screen with a new finger.

d) False. Resetting the Path does not erase its corresponding painted line from the screen, because those lines have already been drawn to the bitmap that’s displayed to the screen.

e) False. The method MediaStore.Images.Media.insertImage ...

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.