Android Tutorial

(avery) #1

By : Ketan Bhimani


128 

(android.content.res.Resources) has helper methods for handling
every kind of resource.

Before we go any further, we find it can be helpful to dig in and
create some resources, so let’s create a simple example. Don’t
worry if you don’t understand every aspect of the exercise. You can
find out more about each different resource type later in this
chapter.

Setting Simple Resource Values Using Eclipse

Developers can define resource types by editing resource XML files
manually and using the aapt to compile them and generate the
R.java file or by using Eclipse with the Android plug-in, which
includes some very handy resource editors.

To illustrate how to set resources using the Eclipse plug-in, let’s
look at an example. Create a new Android project and navigate to
the /res/values/strings.xml file in Eclipse and double-click the file to
edit it. Your strings.xml resource file opens in the right pane and
should look something like Figure.

The string resource file in the Eclipse Resource Editor (Editor view).
Free download pdf