Java Reference
In-Depth Information
mentstheactivity.Thisnamebeginswithaperiodcharactertoimplythatit'srelativeto
ca.tutortutor.simpleapp
.
Note
The period isn't present when
AndroidManifest.xml
is created at the
commandline.However,thischaracterispresentwhenthisfileiscreatedfromwithin
Eclipse. Regardless,
SimpleActivity
is relative to
<manifest>
's
package
value (
ca.tutortutor.simpleapp
).
The
activity
elementcanoverride
application
's
label
and
icon
attributes
withitsowncomponent-specific
label
and
icon
attributes.Wheneitherattributeisn't
present,
activity
inherits
application
's
label
or
icon
attribute value.
Nestedwithin
activity
is
intent-filter
.Thiselementdeclaresthecapabil-
itiesofthecomponentdescribedbytheenclosingelement.Forexample,itdeclaresthe
capabilities of the
SimpleActivity
component via its nested
action
and
cat-
egory
elements:
•
action
identifies the action to perform. For example, this element's
name
attribute can be assigned
"android.intent.action.main"
to identify
the activity as the app's entry point (the first activity to run when the user
launches the app).
•
category
identifies a component category. This tag's
name
attribute is as-
signed
"android.intent.category.launcher"
toidentifytheactiv-
ity as needing to be displayed in the app launcher (discussed later).
Note
Othercomponentsaresimilarlydeclared:broadcastreceiversaredeclaredvia
receiver
elements, content providers are declared via
provider
elements, and
services are declared via
service
elements. Except for broadcast receivers, which
canbecreatedatruntime,componentsnotdeclaredinthemanifestarenotcreatedby
Android.
The
<!-- ... -->
comment tag indicates that a manifest can define multiple
components.Forexample,Ireferredtoa
SimpleActivity2
classwhilediscussing
activities.Beforeyoucouldstartthisactivity(explicitlyorimplicitly),youwouldneed
to introduce an
activity
element into the manifest.
Consider the following
activity
element:
<activity android:name=".simpleactivity2" ...>
<intent-filter>
<action
android:name="android.intent.action.view"
/>