Answers to Self-Review Exercises

  1. 5.1

    1. SensorEventListener.

    2. curves.

    3. dragged across the screen.

    4. unregisterListener.

    5. onSensorChanged.

    6. onAttach.

    7. onDraw.

    8. getActionMasked.

  2. 5.2

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

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

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

    4. 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.

    5. False. The method MediaStore.Images.Media.insertImage saves a Bitmap into the ...

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.