Fastest way for creating RecyclerView Adapter

Hi,

I decide to move this blog to different domain, so this is new link http://kristijandraca.com/2017/03/22/fastest-way-for-creating-recyclerview-adapter/

Advertisements

4 thoughts on “Fastest way for creating RecyclerView Adapter”

  1. Butterknife requires a lot of private fields and annotations in your code, and it’s a heavy third party library. So you end up with more code to bug fix and test and a bigger app to ship to customers making their downloads longer and app slower.

    Databinding, on the other hand, has no third party library, since it is provided by Google. The fields are all generated for you in the binding class that is generated for your XML, and they match whatever views you gave IDs to in the XML. In Butterknife you put an ID attribute in your XML, then you put a field in your Java code, then you put an annotation in your Java code. Three things to write instead of one.

    You also rarely need to even give IDs to views since often they just have a databinding expression and never have to be accessed directly. You change the value they are binded to, and provided you used ObservableField or similar, it updates the view automatically without you ever having to access the view. So in a lot of cases it even removes the need for an ID attribute at all.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s