Issue
I simply made an adapter for my recyclerview.like this :
class CustomerAdapter(mCtx:Context,val customers:ArrayList<Customer>):RecyclerView.Adapter<CustomerAdapter.ViewHolder>(){
and i have a xml layout file to inflate recycleview items.
But the problem is in onCreateViewHolder
... I can not access inflated elements ...
codes writed in my onCreateViewHolder method :
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomerAdapter.ViewHolder {
val v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lo_customers, parent, false);
var txt = v.id
}
i can not access view elements by id .
Solution
Problem Solved.
At gradle app
plugins {
id 'kotlin-android-extensions'
}
or
apply plugin: 'kotlin-android-extensions'
then your Activity Import this
import kotlinx.android.synthetic.main.activity_main.*
Answered By - sam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.