
clicking and tapping to operate. Sure, there are menus and buttons to be tapped, but
Android has an innovative design element to its architecture known as an intent.
The intent
An intent is a construct that permits an application to issue a request, which is
somewhat like a help-wanted sign. It might look like this:
"Wanted: An application to help me look up a contact" or "Wanted: An application to
help me display this image" or "Wanted: An application to perform this
geographic-based search."
In a similar and complementary fashion, applications can register themselves as
capable and interested in performing satisfying various requests or intents. To follow
the classified advertising paradigm, these might look like this:
"Available: Application ready and willing to present contact records in clear, concise
manner," or "Available: Application ready and willing to perform a geographic
search."
These are examples of IntentFilters, which are discussed next.
The IntentFilter
Applications announce their availability to perform these types of operations via a
construct known as an IntentFilter. The IntentFilter is either registered at
runtime or is enumerated in the AndroidManifest.xml file. The following snippet
comes from an Android application that responds to incoming SMS (text) messages:
Listing 1. Android application responding to incoming SMS
<receiver class=".MySMSMailBox" >
<intent-filter>
<action android:value="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
After this brief introduction to the intent and IntentFilter, the next section
introduces the four main types of Android applications.
Section 3. Android applications A quick survey
ibm.com/developerWorks developerWorks®
Develop Android applications with Eclipse
© Copyright IBM Corporation 1994, 2008. All rights reserved. Page 5 of 35
Kommentare zu diesen Handbüchern