Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class OperationAdapter (val context: Context,private val arrayList: ArrayList <Operations>):
- RecyclerView.Adapter <OperationAdapter.Holder> () {
- companion object {
- val TAG: String = OperationAdapter::class.java.simpleName
- }
- override fun onCreateViewHolder (parent: ViewGroup, viewType: Int): Holder {
- return Holder (LayoutInflater.from (parent.context ).inflate (R.layout.operaitemlist , parent, false))
- }
- override fun getItemCount (): Int = arrayList. size
- override fun onBindViewHolder (holder: Holder, position: Int) {
- holder.itemView.txtphonenumber.text = arrayList[position].phone
- holder.itemView.txttime.text = arrayList[position].etime
- holder.itemView.cardview.setOnClickListener {
- val alertDialog = AlertDialog.Builder(context)
- .setTitle("My title")
- .setCancelable(true)
- .setMessage("My message")
- alertDialog.show()
- //Toast.makeText(context,"Click ${arrayList[position].id}",Toast.LENGTH_SHORT).show()
- }
- }
- class Holder (itemView: View): RecyclerView.ViewHolder (itemView)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement