Sign in Go Pro

Android Model-View-ViewModel Pattern

Creating An AlertDialog with a RecyclerView - Part 1

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



This lesson will teach you how to create an AlertDialog that shows a list of items in a RecyclerView. We'll create the AlertDialog together in this lesson and through the process, you'll learn how to inflate a view separately and configure it for the AlertDialog, awareness of the Kotlin Android Extensions library and the syntactic sugar it provides for looking up views by their id, and some other tidbits about Recycler Views and other useful tips along the way.

Key concepts in this lesson that you will learn:

  • How to add a define a custom view separately inside a layout file and inflate it inside onCreateDialog(...).
  • How to make the root view of an item inside a RecyclerView appear clickable to the user.
  • Understanding of Kotlin Synthetic View accessors, how they relate to findViewById and where they come from.
  • The concept of a DataTransferObject, or DTO, for use in the View.

  • Review of DialogFragment(), why we use it to wrap AlertDialogs and how to communicate back to the hosting Activity.

  • Review of creating menus in Android and showing a Dialog as a result of a menu item selection, as well as handling the menu item click.

  • Review of converting a layout file to use data binding, using the quick assist feature in Android.


There are no comments on this lesson, start the conversation below ...


Lessons in Android Model-View-ViewModel Pattern