Creating the Silent Mode Toggle Application

Create the new application by choosing File⇒New Project. Choose Android Project from the list, and then click the Next button. Use Table 4-1 for your project settings.

Table 4-1 Project Settings for Silent Mode Toggle

Setting

Value

Application Name

Silent Mode Toggle

Project name

Silent Mode Toggle

Contents

Leave the default selected (create new project in workspace)

Build target

Android 4.1

Package name

com.dummies.android.silentmodetoggle

Create activity

MainActivity

Min SDK Version

8 (2.2)

Click the Finish button. You should now have the Silent Mode Toggle application in your Package Explorer, as shown in Figure 4-1.

technicalstuff.eps If you receive an error that looks similar to this — “The project cannot be built until build path errors are resolved” — you can resolve it by right-clicking the project and choosing Android Tools⇒Fix Project Properties. This realigns your project with the IDE workspace.

Figure 4-1: The Silent Mode Toggle application in Eclipse.

9781118417454-fg0401.tif

tip.eps Notice how you set the build target to 4.1 and the minimum SDK to 2.2 (API level 8). What you have done is told Android that your code can ...

Get Android Application Development For Dummies, 2nd 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.