Android Data Binding : Dynamic RecyclerView Adapter
 
 One of the most common list design patterns that I encounter as Android developer is a list with a variation of the following:    Multiple row types.   Expandable/Collapsible rows or sections.   Load more/Scroll to load more.   Delete rows/Sections.     And all of these can be implemented in a generic manner with Android Data Binding library. You can write one adapter for all the RecycleView s in your app and use it to render all the common design patterns. Check out the source for the example in this tutorial here .   Final result:     Lets begin by defining our adapter:   public class RecyclerViewBindingAdapter extends RecyclerView.Adapter<RecyclerViewBindingAdapter.BindingViewHolder> {     private ObservableList<AdapterDataItem> data;      public RecyclerViewBindingAdapter(ObservableList<AdapterDataItem> data) {         this.data = data;         data.addOnListChangedCallback(new ObservableListCallback());     }      @Override     public BindingV...
 
 
