Android Data Binding : Observable List to RecyclerView's Adapter

Is their a way, by using the ObservableList class from the new Data Binding library and the MVVM pattern, to avoid using "notifyItem(s)..." methods from the Adapter class?

Or if not what could be the simpliest way to bind an ObservableList to a RecyclerView?

  • CompoundDrawable size
  • add blink to customized listview Item?
  • Why set setBackgroundColor is not working in my custom listView
  • ViewPager swipe doesn't work with RecyclerView
  • How do I get an apk file from an Android device?
  • Authenticating Dropbox leaves open Browser
  • Thank’s for any clue !

    Related posts:

    Should I obfuscate OAuth consumer secret stored by Android app?
    Android MediaPlayer works fine in Custom audio Streaming application up to Android 2.1 but not in hi...
    android get device overall audio output in pcm
    get launchable activity name of package from adb
    Android install apk with Intent.VIEW_ACTION not working with File provider
    Make paid Android app free for a week?
  • Using JavaCV and Realm together causes “java.lang.UnsatisfiedLinkError”
  • How can I get zoom functionality for images?
  • How to handle errors in custom AsyncTaskLoader?
  • android / phonegap performance
  • How do I connect a Lenovo IdeaPad S6000 to Windows 7 (64-bit)
  • What is the SortedList<T> working with RecyclerView.Adapter?
  • One Solution collect form web for “Android Data Binding : Observable List to RecyclerView's Adapter”

    Have a look at following implementation of the RecyclerView‘s adapter:

    https://github.com/radzio/android-data-binding-recyclerview/blob/master/recyclerview-binding/src/main/java/net/droidlabs/mvvm/recyclerview/adapter/BindingRecyclerViewAdapter.java

    It automatically notifies the recycler view if the OnListChangedCallback is called.

    Also have a look at the rest of the repository. It shows how to bind your ObervableList to the adapter using xml. So that you can have something like this:

    app:items="@{usersViewModel.users}"
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.