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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.