7.5. DoodleFragment Class

Class DoodleFragment (Figs. 7.127.19) displays the DoodleView (Section 7.6), manages the menu options displayed on the action bar and in the options menu and manages the sensor event handling for the app’s shake-to-erase feature.

 1   // DoodleFragment.java 2   // Fragment in which the DoodleView is displayed 3   package com.deitel.doodlz; 4  5   import android.app.Fragment; 6   import android.content.Context; 7   import android.graphics.Color;               8   import android.hardware.Sensor;              9   import android.hardware.SensorEvent;        10   import android.hardware.SensorEventListener;11   import android.hardware.SensorManager;      12   import android.os.Bundle;13    ...

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.