From the course: Android Development: Modern Android UI Design Elements

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Define BaseViewHolder

Define BaseViewHolder

- [Narrator] Now that we have our model defined, we are ready to create the class that will manage access to our models and that will be the RecyclerView adapters. But before we create the RecyclerView adapters, let's first create an abstract base class that will be used by our RecyclerView adapters. This abstract base class is called BaseViewHolder and its purpose is to define the structure that all view holders must follow. This also allows the RecyclerView adapter to work with a generic abstract base class instead of specific view holders for albums or photos. Okay, so let's go ahead and create our BaseViewHolder by going to our package and under our package, we're going to go under UI Google photos and we're going to right mouse, create a new package and we're going to call it view holders. So now we have our new package and we will create a new file, new Java class, and we will call it BaseViewHolder and the modifier we're going to select is abstract because we have an abstract…

Contents