7.1 Fill in the blanks in each of the following statements:
a) You use the SensorManager
to register the sensor changes that your app should receive and to specify the _________ that will handle those sensor-change events.
b) A Path
object (package android.graphics
) represents a geometric path consisting of line segments and _________.
c) You use the type of the touch event to determine whether the user has touched the screen, ________ or lifted a finger from the screen.
d) Use class SensorManager
’s _________ method to stop listening for accelerometer events.
e) Override SensorEventListener
method _________ to process accelerometer events.
f) Override Fragment
method _________ to respond to the event when a Fragment is attached to a parent Activity
.
g) When a View
needs to be redrawn, its ________ method is called.
h) MotionEvent
’s _________ method returns an int
representing the MotionEvent
type, which you can use with constants from class MotionEvent
to determine how to handle each event.
i) Android 4.4’s _________ enables an app to take advantage of the entire screen.
7.2 State whether each of the following is true or false. If false, explain why.
a) You unregister the accelerometer event handler when the app is sent to the foreground.
b) Call the inherited View
method validate
to indicate that the View
needs to be redrawn.
c) If the action is MotionEvent.ACTION_DOWN
or MotionEvent.ACTION_POINTER_DOWN
, the user touched the screen with the same finger.
d) Resetting the Path
erases its corresponding painted line from the screen, because those lines have already been drawn to the bitmap
that’s displayed to the screen.
e) Method MediaStore.Images.Media.saveImage
saves a Bitmap
into the device’s Gallery.