The Content helps those who wish to program mobile applications using android platform. The content has been used to conduct mobile application boot camps using android platform on different regions in Tanzania
2. Android Manifest xml File
Every application must have an A ro id
nd
M nife s t. x m l file
a
(with precisely that name) in its root directory.
The manifest presents essential information
about the application to the Android system.
information the system must have before it can run
any of the application's code.
5. AndroidManifest.xml
Applications should declare everything needed
on the the AndroidManifest.xml file …
One AndroidManifest.xml for application ..
What's contained in it?
Pe rm is s io ns
Hw a nd Sw re s o urc e s us e d by the
A p lic a tio n
p
A tivitie s
c
I nt-filte rs
nte
5
6. Android Manifest xml File
The manifest is made up of a root manifest ta g
with a package attribute set to the project’s
package.
It usually includes an x m lns : a nd ro id attribute
that supplies several system attributes used
within the file.
The m a nife s t ta g includes nodes that define the
application components, security settings, and
test classes that make up your application.
7. Activities and
AndroidManifest.xml
An Android application can be composed of
multiple Activities …
Each activity should be declared in the file:
AndroidManifest.xml
Add a child element of <application>:
<application>
<activity android:name=".MyActivity" />
<activity android:name=”.SecondActivity" />
</application>
7
9. Android Manifest xml File
Available manifest node tags, and an XML snippet
demonstrating how each one is used:
A p lic a tio n: A manifest can contain only one application
p
node.
It uses attributes to specify the metadata for your
application (including its title, icon, and theme).
It also acts as a container that includes the Activity,
Service, Content Provider, and Broadcast Receiver tags
used to specify the application components.
11. <manifest>
The manifest tag has the following attributes:
xmlns ; the name of the namespace (android) and
where the DTD for the xml parser is located.
package ; the name of the java package for this
application (must have at least two levels).
android:version ; the version code for this version of the
app.
android:versionName ; The version name (for
publishing)
12. <activity>
Child tag of <manifest>
Need one <activity> tag for each activity of the
application
Attributes:
android:name; the name of the activity, this will be
used as the name of the Java file and the
resulting class.
android:label; a string that we will be able to
programmatically retrieve the activity name at run
time.
13. <intent-filter>
Child tag of <activity>
First, what’s an intent? In OO-speak an intent is a message sent
from one program to another (message dispatcher) to tell the
system what to do next.
Typically an intent consists of two parts; an action and the data
that that action is supposed to use to do it.
When you select an icon on the main page the intent is to run the
app associated with that icon.
The tag is used to construct an android.content.IntentFilter object
to handle a particular android.content.Intent
14. Launcher
When you create a new application using the
Android SDK tools.
The stub activity that's created for you
automatically includes an intent filter that
declares the activity responds to the "main"
action.
It should be placed in the "launcher" category.