7.8. LineWidthDialogFragment Class

Class LineWidthDialogFragment (Fig. 7.39) extends DialogFragment to create an AlertDialog for setting the line width. The class is similar to class ColorDialogFragment, so we discuss only the key differences here. The class’s only instance variable is an ImageView (line 22) in which we draw a line showing the current line-width setting.

 1   // LineWidthDialogFragment.java 2   // Allows user to set the drawing color on the DoodleView 3   package com.deitel.doodlz; 4  5   import android.app.Activity; 6   import android.app.AlertDialog; 7   import android.app.Dialog; 8   import android.app.DialogFragment; 9   import android.content.DialogInterface;10   import android.graphics.Bitmap; ...

Get Android™ How to Program, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.