Creating Resources

Application resources are stored under the res/ folder of your project hierarchy. In this folder each of the available resource types are stored in a subfolder containing those resources.

If you start a project using the ADT wizard, it will create a res folder that contains subfolders for the values, drawable-ldpi, drawable-mdpi, drawable-hdpi, and layout resources that contain the default layout, application icon, and string resource definitions respectively, as shown in Figure 3-4.

Note that three Drawable resource folders are created with three different icons, one each for low, medium, and high DPI displays.

Nine primary resource types have different folders: simple values, Drawables, layouts, animations, styles, menus, searchables, XML, and raw resources. When your application is built, these resources will be compiled as efficiently as possible and included in your application package.

This process also generates an R class file that contains references to each of the resources you include in your project. This lets you reference the resources in your code, with the advantage of design-time syntax checking.

The following sections describe many of the specific resource types available within these categories and how to create them for your applications.

In all cases the resource file names should contain only lowercase letters, numbers, and the period (. ) and underscore (_) symbols.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment