O'Reilly logo

Android Application Development For Dummies, 2nd Edition by Donn Felker, Michael Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required