Chapter 17. Recycler View Navigation: Pick a Card

image

Some apps rely on the user selecting an item from a list.

And in this chapter, you’ll learn how to make recycler views a core part of your app design by making their items clickable. You’ll discover how to implement recycler view navigation by making the app navigate to a new screen each time the user clicks on a record. You’ll find out how to show the user extra information about their chosen record, and update it in the database. By the end of this chapter, you’ll have all the tools you need to transform your awesome ideas into the app of your dreams…

Recycler views can be used for navigation

In the previous two chapters, you learned how to build a recycler view that displays a scrollable list of data, and used DiffUtil to make it more efficient. But this isn’t the end of the story.

Recycler views are a major component of many Android apps because, in addition to displaying lists of data, you can use them to navigate through the app. When the user clicks on an item in the recycler view, you can make the app navigate to a new fragment, which displays further details of that record.

To see how this works, we’re going to change up the Tasks app so that when the user clicks on one of the tasks in its recycler view, it navigates to a new fragment. This fragment will display the record that’s been selected, and let ...

Get Head First Android Development, 3rd 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.