12 Fragment Navigation

In this chapter, you will get the list and the detail parts of CriminalIntent working together. When a user presses an item in the list of crimes, MainActivity will swap out CrimeListFragment with a new instance of CrimeFragment. CrimeFragment will display the details for the crime that was pressed (Figure 12.1).

Figure 12.1  Swapping CrimeListFragment for CrimeFragment

Swapping CrimeListFragment for CrimeFragment

To get this working you will learn how to implement navigation by having the hosting activity change out fragments in response to user actions. You will also learn how to pass data to a fragment instance using fragment arguments. Finally, ...

Get Android Programming: The Big Nerd Ranch Guide, 4th 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.