Android Tutorial

(avery) #1

By : Ketan Bhimani


124 

Storing Graphics, Animations, Menus, and Files

In addition to simple resource types stored in the /res/values
directory, you can also store numerous other types of resources,
such as animation sequences, graphics, arbitrary XML files, and raw
files. These types of resources are not stored in the /res/values
directory, but instead stored in specially named directories
according to their type. For example, you can include animation
sequence definitions in the /res/anim directory. Make sure you
name resource files appropriately because the resource name is
derived from the filename of the specific resource. For example, a
file called flag.png in the /res/drawable directory is given the name
R.drawable.flag.

Understanding How Resources Are Resolved

Few applications work perfectly, no matter the environment they
run in. Most require some tweaking, some special case handling.
That’s where alternative resources come in. You can organize
Android project resources based upon more than a dozen different
types of criteria, including language and region, screen
characteristics, device modes (night mode, docked, and so on),
input methods, and many other device differentiators.

It can be useful to think of the resources stored at the top of the
resource hierarchy as default resources and the specialized
versions of those resources as alternative resources. Two common
reasons that developers use alternative resources are for
internationalization and localization purposes and to design an
application that runs smoothly on different device screens and
orientations.
Free download pdf