More Resource Rules and Regulations

Now that you are more familiar with the Android resource system, here are some system requirements you should know about when it comes time to build your own apps.

Resource naming

Resource names must be lowercase and must not have any spaces – one_small_step.wav, app_name, armstrong_on_moon.jpg.

Whether you reference a resource in XML or code, the reference does not include the file extension. For example, you refer to @drawable/armstrong_on_moon in your layout files and R.drawable.armstrong_on_moon in your code. This means that you cannot rely on extensions to distinguish identically named resource files in the same subdirectory.

Resource directory structure

Resources must be saved in a subdirectory of

Get Android Programming: The Big Nerd Ranch Guide 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.