20.08.2016 Views

Professional Android 4 Application Development

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CONTENTS<br />

Updating Menu Items Dynamically 385<br />

Handling Menu Selections 386<br />

Introducing Submenus and Context Menus 387<br />

Creating Submenus 387<br />

Using Context Menus and Popup Menus 388<br />

Refreshing the Earthquake Monitor 390<br />

Going Full Screen 392<br />

Introducing Dialogs 394<br />

Creating a Dialog 395<br />

Using the Alert Dialog Class 396<br />

Using Specialized Input Dialogs 397<br />

Managing and Displaying Dialogs Using Dialog Fragments 398<br />

Managing and Displaying Dialogs Using Activity Event Handlers 400<br />

Using Activities as Dialogs 401<br />

Let’s Make a Toast 401<br />

Customizing Toasts 402<br />

Using Toasts in Worker Threads 404<br />

Introducing Notifications 405<br />

Introducing the Notification Manager 406<br />

Creating Notifications 407<br />

Creating a Notification and Confi guring the Status Bar Display 407<br />

Using the Default Notification Sounds, Lights, and Vibrations 408<br />

Making Sounds 408<br />

Vibrating the Device 409<br />

Flashing the Lights 409<br />

Using the Notification Builder 410<br />

Setting and Customizing the Notification Tray UI 410<br />

Using the Standard Notifi cation UI 411<br />

Creating a Custom Notification UI 412<br />

Customizing the Ticker View 414<br />

Confi guring Ongoing and Insistent Notifications 415<br />

Triggering, Updating, and Canceling Notifications 416<br />

Adding Notifications and Dialogs to the Earthquake Monitor 418<br />

CHAPTER 11: ADVANCED USER EXPERIENCE 425<br />

Designing for Every Screen Size and Density 426<br />

Resolution Independence 426<br />

Using Density-Independent Pixels 426<br />

Resource Qualifiers for Pixel Density 427<br />

xxvi

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!