Android Lists Made Easy: DataBinding + RecyclerViewBindingAdapter Library

RecyclerViewBindingAdapter Library

This library provides a powerful yet reusable RecyclerView adapter that leverages ObservableArrayList and DataBinding to simplify your life. Tell the adapter which layouts your models map to and then just modify your observable list and the adapter takes care of the rest. Its that simple! Check out the library and example app source code here.


Step 1:


Add jitpack repository to you project's build.gradle file


Step 2:

Enable Android data binding and add library dependency in the module's build.gradle file that you will be using the library in. You will need data binding to create layouts bound to ViewModels. The adapter dynamically creates all the rows and manages recycling of the layouts.


Step 3:


Create ObservableArrayList that will hold all the view models and initialize EasyRecyclerAdapter with it. Set up the mappings between the layouts you intend to show in the list and the view model and the variable id (variable name) from the layout's <variable> tag.

Step 4:

For each row you need to create a view model that has some data and a layout with elements that use ViewModel's properties.


and the layout uses the view model.
Resources:
-Source code for library and sample app here
-My intro lesson on DataBinding here
-Official DataBinding documentation here

Liked this blog post? Want to learn more? 

Take my Udemy course on Android Data Binding here:

course image 


Comments


  1. Best Article buy Pain Pills online Excellent post. I appreciate this site. Stick with it! Because the admin of this web page is working, no doubt very quickly it will be well-known, due to its quality contents.This website was how do you say it? Relevant!! Finally, I’ve found something that helped me.
    Best Article buy Roxicodone online Excellent post
    buy Xanax online
    buy Oxycodone online

    Best Article buy Pain Medications online Excellent post. I appreciate this site. Stick with it! Because the admin of this web page is working, no doubt very quickly it will be well-known, due to its quality contents.This website was how do you say it? Relevant!! Finally, I’ve found something that helped me.

    buy Research Chemicals online

    buy Roxicodone online

    buy Cbd Isolate online

    ReplyDelete
  2. Great Article android based projects

    Java Training in Chennai Project Center in Chennai Java Training in Chennai projects for cse The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training Project Centers in Chennai

    ReplyDelete

Post a Comment

Popular posts from this blog

Android Architecture Components : LiveData

Building a Cryptocurrency with Kotlin : Part 1

Android Data Binding : Dynamic RecyclerView Adapter