Project Components
src
– your source code
gen
– auto-generated code (usually just R.java)
libs - Included libraries
Resources
Drawables
(like .png images)
Layouts
Values
(like strings)
Manifest
file
SRC(Contains Source Code)
In
Android Development the src folder is where all you put your main
Java code
EX. MainActivity.Java
XML
Used
to define some of the resources
Layouts
(UI)
Strings
Manifest
file
Shouldn’t
usually have to edit it directly, Eclipse can do that for you
Preferred
way of creating UIs
Separates
the description of the layout from any actual code that controls it
Can
easily take a UI from one platform to another
R Class
Auto-generated:
you shouldn’t edit it
Contains
IDs of the project resources
Enforces
good software engineering
Use
findViewById and Resources object to get access to the resources
Ex.
Button b = (Button)findViewById(R.id.button1)
Ex.
getResources().getString(R.string.hello));
Layout
Eclipse
has a great UI creator
Generates
the XML for you
Composed
of View objects
Can
be specified for portrait and landscape mode
Use
same file name, so can make completely different UIs for the
orientations without modifying any code.
Strings
In
res/values
strings.xml
Application
wide available strings
Promotes
good software engineering
UI
components made in the UI editor should have text defined in
strings.xml
Strings
are just one kind of ‘Value’ there are many others
Menifest File
Contains
characteristics about your application
When
have more than one Activity in app, NEED to specify it in manifest
file
Go
to graphical view of the manifest file
Add
an Activity in the bottom right
Browse
for the name of the activity
Need
to specify Services and other components too
Also
important to define permissions and external libraries, like Google
Maps API
Drawables
A
Drawable resource is
a general concept for a graphic which can be drawn. The simplest case
is a graphical file, which would be represented in Android via a
BitmapDrawable
class. Bitmaps are typically stored in one of
theres/drawable
folders. The Android project creation wizard
creates several of these folders by default, you can provide
different sized files for different resolutions of Android devices.
If you only provide one file for all sizes the Android system will
scale the resource.
In
additional to graphical files, Android supports XML drawables and
9-patch graphics. XML drawables are used to describe shapes (color,
border, gradient), State and Transitions and more.
9-patch
graphics are used to define which part of a graphic should be
stretched if the
Libs
The /lib folder is used to import library files in project that executables make use of and also you can import third party library files .
View
which
uses this graphic is larger than the graphic.Libs
The /lib folder is used to import library files in project that executables make use of and also you can import third party library files .