https://kotlinlang.org logo
n

neil

06/15/2016, 3:58 PM
I am trying to create a RecyclerView with two types of ViewHolder, I have set the types as constants in the companion object of the RecyclerView.
companion object {
val ITEM_VIEW_TYPE_HEADER = 0
val ITEM_VIEW_TYPE_CONTENT = 1
}
In onCreateViewHolder I have a when which inflates the layout and constructs the view holder.
ITEM_VIEW_TYPE_HEADER -> return HeaderViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_feedback_header, parent, false))
Is there a way to use the kotlin android extensions on the view Holder to access the TextView in item_feedback_header or do I have to to findById ?