Chapter 4
Designing the User Interface
In This Chapter
Setting up the Silent Mode Toggle application
Designing the layout
Developing the user interface
Adding an image and a button widget
Making a launcher icon
Previewing your work
In Chapter 3, you discover what Android is and how to build your first application. This chapter helps you delve into the fun stuff: building a real application and publishing it to the Google Play Store.
The application you build in this chapter allows the user to toggle the ringer mode on the phone by simply pressing a button. This application seems simple, but it solves a real-world problem.
Imagine that you’re at work and you’re about to go to a meeting. You can turn down the volume on your phone to silence it and then attend the meeting. (You wouldn’t want to be the one whose phone always rings during a meeting, would you?) The problem is that you like your ringer loud, but not too loud, so you use only the second-to-loudest setting. When you leave your meeting, you remember to restore the ringer volume, but you always have to move all the way to the maximum volume and then down one setting, to ensure that you have the correct one. Though this event isn’t life changing, it’s a nuisance to complete every time you need to silence your phone’s ringer.
If an application would allow you to tap a button to turn off the ringer and then, when you leave the meeting, tap the button again to restore the ringer to the last state it was in, you would never have to readjust it again. That’s the application you’re about to build.