Android Development Slides Lec 05 GCUF
Android Development Slides Lec 05 GCUF
Development
Lecture # 05
M. Javed Iqbal
Anatomy of an Android Application
Android uses a special class
called Intent to move from screen to
screen. Intent describe what an
application wants done. The two most
important parts of the intent data
structure are the action and the data to
act upon. Typical values for action are
MAIN (the front door of the application)
• There are four building blocks to an
Android application:
• Activity
• Intent Receiver
• Service
• Content Provider
Not every application needs to have all
four, but your application will be written
with some combination of these.
Once you have decided what
components you need for your
application, you should list them in a file
called AndroidManifest.xml. This is an
XML file where you declare the
components of your application and
what their capabilities and requirements
are.
src — Contains the .java
source files for your project.
In this example, there is one
file, HelloWorldActivity.java.
The HelloWorldActivity.java
file is the source fi le for your
activity.
You write the code for your
application in this file.
gen — Contains the R.java
file, a compiler-generated
file that references all the
resources found in your
project.
You should not modify this
file. All the resources in your
project are automatically
compiled into this class so
that you can refer to them
using the class.
Android 4.0 library —
This item contains one
file,android.jar, which
contains all the class
libraries needed for an
Android application.
assets — This folder
contains all the
assets used by your
application, such as
HTML, text files,
databases, etc.
bin — This folder contains
the files built by the ADT
during the build process.
In particular, it generates
the .apk file. An .apk file is
the application binary of
an Android application. It
contains everything
needed to run an Android
application.
res — This folder
contains all the
resources used in
your application. It
also contains a few
other subfolders:
drawable-
<resolution>, layout,
and values.
AndroidManifest.xml —
This is the
manifest file for your
Android application.
Here you specify the
permissions needed by
your application, as
well as other features
(such as intent-filters,
receivers, etc.)
main.xml
The main.xml file
defines the user
interface for your
activity.
<TextView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”@string/hello” />
The @string in this case
refers to the strings.xml
file located in the
res/values folder.
<?xml version=”1.0” encoding=”utf-8”?>
<resources>
<string name=”hello”>Hello World,
HelloWorldActivity!</string>
<string
name=”app_name”>HelloWorld</string>
</resources>
The AndroidManifest.xml
file contains detailed
information about the
application:
1.It defines the package
name of the application.
2.
The version code of the
application.