ptg7068951
Designing a Real App 357
The /resfolder of a new project contains folders called drawable-hdpi,
drawable-mdpi, and drawable-lpdithat have three different versions of
icon.png, the app’s icon. The icon is the small graphic used to launch
the app.
The three versions of icon.pngare the same graphic sized for high-
resolution, medium-resolution, and low-resolution displays. You won’t be
using these icons, so it’s OK to delete them: Click one of the icon.pngfiles
in Package Explorer, and then press the Delete key. You’ll be asked to con-
firm each deletion.
Deleting these files causes two red X’s to appear in Package Explorer: One
over AndroidManifest.xmland another over the top-level Leaderitem
(which are identified in Figure 24.11). These X’s indicate that the app now
has errors that will prevent it from being compiled and run.
The errors cropped upbecause the app now lacks an icon. Anew graphics
file, appicon.png, will be added to the project and designated as its icon in
the file AndroidManifest.xml, the app’s main configuration file.
This book’s website contains appicon.pngand four other graphics files
needed by this app: browser.png, maps.png, phone.png, and
whitehouse.png. Visit http://www.java24hours.com and go to the Hour 24 page
for this edition of the book. Download all five files and save them in a tem-
porary folder on your computer.
Android’s support for multiple resolutions is handy, but it’s not necessary
here. Instead of using the existing drawablefolders, a new one will be cre-
ated by following these steps:
- Click the /resfolder in Package Explorer to select it.
- Choose File, New, Folder. The New Folder dialog opens.
- Enter drawablein the Folder Name field.
- Click Finish.
A new folder will be created inside /rescalled drawable. All the graphics
needed by the app can be stored here without consideration of their
resolution.
FIGURE 24.11
Detecting andfixing errors in
the app.