https://kotlinlang.org logo
#android
Title
# android
v

Vague

06/04/2019, 1:57 PM
Should I use DataBinding in a RecyclerView? Or is it an overkill?
e

escodro

06/04/2019, 1:58 PM
In the component or in the items? In the RecyclerView itself, it may be not necessary. But in the items is a good call to avoid ViewHolders.
v

Vague

06/04/2019, 2:05 PM
Using it in place of findViewById...
e

escodro

06/04/2019, 2:07 PM
You can simply use Kotlin Synthetic access for it. Or wait for the new View Binding. 😊
1
v

Vague

06/04/2019, 2:11 PM
Meh, yeah... Kotlin Synthetic in comparison to DataBinding, any performance difference or tradeoffs?
e

escodro

06/04/2019, 2:13 PM
Image from iOS.jpg
That was shown in Google IO. The "???" Is the new View Binding.
v

Vague

06/04/2019, 2:17 PM
I'm guessing it's not stable yet?
e

escodro

06/04/2019, 2:24 PM
No, it is not. I would go with Synthetic if you only need the
findViewById
. Data Binding seems like a overkill.
v

Vague

06/04/2019, 2:28 PM
Okay... Thanks
😊 1
r

rook

06/04/2019, 4:15 PM
My information might be out-of-date, but one consideration you might make is that synthetics in `ViewHolder`s have to be re-evaluated every time it is reused. This can affect performance
👍 1
g

ghedeon

06/04/2019, 4:31 PM
isn't it what
LayoutContainer
for? Iirc it will be cached.
r

rook

06/04/2019, 7:16 PM
You’re correct. I wasn’t aware of
LayoutContainer
until you mentioned it. Relevant docs: https://kotlinlang.org/docs/tutorials/android-plugin.html#layoutcontainer-support
s

Sergio C.

06/04/2019, 10:43 PM
What's the objective of layout container?
5 Views