A reference to the res directory and its contents is contained by the file, located in the src directory. This file is covered in much more detail later in the chapter.

The drawable directory contains actual image files that your application can use and reference. The layout directory holds an XML file, main.xml, that is referenced by your application when building its interface. In most of the applications in this book, you will be editing the main.xml file included in the layout directory. This will allow you to insert

Views into the application's visual layout and display them. An unaltered main.xml file contains the following code:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=



android:layout_height="fill_parent" >

<TextView android:layout_width="fill_parent" android:layout_height="wrap_content"

android:text="Hello World, HelloWorldText" />


The last directory under res, values, holds an XML file named strings. The strings.xml file is used to hold global string values that can be referenced by your application.

assets Directory

The assets directory is used to hold raw asset files. The files contained in the assets directory can include audio files for streaming and animation assets. I will not use any audio assets in the applications for this book because the beta audio drivers for the Android Emulator are not yet optimized.

src Directory

The src directory contains all the source files for your project. When your project is first created, it will contain two files, and <activity>.java (in this example,, described next.

0 0

Post a comment