Identifying Your Intent

Even applications that have only two screens (such as the Task Reminder application) have a great deal happening behind the scenes. One notable interaction that happens between the application and the user is the introduction of new screens as the user tries various features of the application. As with any application that has a rich feature set, the user can interact with each screen independently. The big question that arises is, “How does a user open another screen?”

Screen interaction is handled via the Android intent system. In the following sections, you set up intents that allow the user to navigate from one screen to the next. Thankfully, it’s a simple process. (Turn to Chapter 7 to find out more about the intent system.)

Starting new activities with intents

Activities are initiated via the Android intent framework. An Intent is a class that represents a message that’s placed in 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 of applications to choose from. (This chooser concept is explained in the later section “Creating a chooser.”) You can think of an intent as an abstract description of an operation.

Starting a particular activity is easy. In your ReminderListFragment, type the following code into the onListItemClick() method:

@Override

public void onListItemClick(ListView l, View v, int position, ...

Get Android Application Development For Dummies, 2nd Edition 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.