Playing with Intents
Intent-based programming is one of the most distinctive features of the Android platform. The entire
application space effectively consists of components (called Activities in Android parlance) and messages
among components (called Intents). The Android application model is therefore a simple service-oriented
architecture which is indeed an interesting approach.
Intents can used in many ways to invoke another Activity. The tutorial is not very explicit on the two main
kinds of Intents so the I had to discover them myself in the documentation of the Intent class.
• Explicit intent targets a particular class that has been declared intent receiver in the
Implicit intent targets an intent receiver with particular characteristics (like a particular action)
Intent-based programming is interesting that's why I decided to play around with it. I had very unpleasant
experiences with the Blogger engine rendering preformatted text like program code (in addition, the engine
swallowed inexplicably part of an XML sample document that I tried to insert into the post) so I decided to
upload the project bundles onto a download page so that I can copy into the post only the relevant code
fragments. Note that sdk-folder and android-tools properties in the build.xml files need to be updated so that
they reflect the location of your Android SDK installation directories.
I tried out three setups in the simple test program (that actually consists of two Android applications).
• Explicit intent addressing with the invoked activity internal to the application (exp/int).
• Explicit intent addressing with the invoked activity external to the application (IntentSender
application invokes IntentReceiver application) (exp/ext).
Implicit intent addressing with external activity invocation (imp/ext). The invoked activity is again in
the IntentReceiver application.
Download the project bundle from here, compile a