class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
fun bindata(text: SingleText){
itemView.title.text = text.title
itemView.desc.text = text.desc
}
}
like this code, Kotlin has any cache in android-extensions?
when i decompile kotlin bytecode
public final void bindata(@NotNull SingleText text) {
Intrinsics.checkParameterIsNotNull(text, "text");
((AppCompatTextView)this.itemView.findViewById(id.title)).setText((CharSequence)text.getTitle());
((AppCompatTextView)this.itemView.findViewById(id.desc)).setText((CharSequence)text.getDesc());
}
it means when i called binData in Adapter.onBindViewHolder(), it will called findViewById each time
This significantly increases the loss of performance,and It does not achieve the purpose of layout reuse
Kotlin has any cache logic in android-extensions with ViewHolder?