How are people using Kotlin Android Extensions syn...
# android
j
How are people using Kotlin Android Extensions synthetics with ViewHolders? Do you store the view in the holder? Example #1
Copy code
class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        val nameEditText = view.nameEditText
    }

    // in adapter (onBindViewHolder)
    holder.nameEditText.text = "Foo"
OR... do you access the view synthetic directly? Example #2
Copy code
class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
    }

    // in adapter (onBindViewHolder)
    holder.itemView.nameEditText.text = "Foo"
It seems that only Activities and Fragments cache the synthetics... (https://youtrack.jetbrains.com/issue/KT-10542)... so if I don't store the EditText in the ViewHolder, will it do a findViewById(...) on every onBindViewHolder(...)?