Identifying Your Intent
Though some applications require only a couple of screens (such as the Task Reminder application which requires a way to view the task and edit a task), a lot can be happening behind the scenes. One such notable interaction is the introduction of new screens as the user uses various features of the application. As with any application with a rich feature set, the user can interact with each screen independently. Therefore the big question arises: “How do I open another screen?”
Screen interaction is handled through Android's intent system. I have covered the intent system in detail in Chapter 8, but I have not covered an example of how to navigate from one screen to the next using an intent. Thankfully, it's a simple process — and I bet you're happy about that!
Starting new activities with intents
Activities are initiated through the Android intent framework. An Intent is a class that represents a message that is placed on the Android intent system (similar to a message-bus type of architecture), and whoever can respond to the intent lets the Android platform know, resulting in either an activity starting or a list appearing of applications to choose from (this is known as a chooser, explained shortly). One of the best ways to think of an intent is to think of it as an abstract description of an operation. (For more on intents, refer to Chapter 8.)
Starting a particular activity is easy. In your ReminderListActivity, type the following code into the onListItemClick() ...
Get Android™ Tablet Application Development For Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.