January 2014
Intermediate to advanced
736 pages
70h 43m
English
Figure 7.16 overrides SensorEventListener method onSensorChanged (lines 100–125) to process accelerometer events. If the user moves the device, this method determines whether the movement was enough to be considered a shake. If so, line 123 calls method confirmErase (Fig. 7.17) to display an EraseImageDialogFragment (Section 7.9) and confirm whether the user really wants to erase the image. Interface SensorEventListener also contains method onAccuracyChanged (lines 128–131)—we don’t use this method in this app, so we provide an empty body because the method is required by the interface.
95 // event handler for ...
Read now
Unlock full access