Skip to content

Most visited

Recently visited


Implementing Descendant Navigation

Descendant navigation is navigation down the application's information hierarchy. This is described in Designing Effective Navigation and also covered in Android Design: Application Structure.

Descendant navigation is usually implemented using Intent objects and startActivity(), or by adding fragments to an activity using FragmentTransaction objects. This lesson covers other interesting cases that arise when implementing descendant navigation.

Implement Master/Detail Flows Across Handsets and Tablets

In a master/detail navigation flow, a master screen contains a list of items in a collection, and a detail screen shows detailed information about a specific item within that collection. Implementing navigation from the master screen to the detail screen is one form of descendant navigation.

Handset touchscreens are most suitable for displaying one screen at a time (either the master or the detail screen); this concern is further discussed in Planning for Multiple Touchscreen Sizes. Descendant navigation in this case is often implemented using an Intent that starts an activity representing the detail screen. On the other hand, tablet displays, especially when viewed in the landscape orientation, are best suited for showing multiple content panes at a time: the master on the left, and the detail to the right). Here, descendant navigation is usually implemented using a FragmentTransaction that adds, removes, or replaces the detail pane with new content.

The basics of implementing this pattern are described in the Implementing Adaptive UI Flows lesson of the Designing for Multiple Screens class. The class describes how to implement a master/detail flow using two activities on a handset and a single activity on a tablet.

Navigate into External Activities

There are cases where descending into your application's information hierarchy leads to activities from other applications. For example, when viewing the contact details screen for an entry in the phone address book, a child screen detailing recent posts by the contact on a social network may belong to a social networking application.

When launching another application's activity to allow the user to say, compose an email or pick a photo attachment, you generally don't want the user to return to this activity if they relaunch your application from the Launcher (the device home screen). It would be confusing if touching your application icon brought the user to a "compose email" screen.

To prevent this from occurring, simply add the FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET flag to the intent used to launch the external activity, like so:

Intent externalActivityIntent = new Intent(Intent.ACTION_PICK);
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)