Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. class OperationAdapter (val context: Context,private val arrayList: ArrayList <Operations>):
  2. RecyclerView.Adapter <OperationAdapter.Holder> () {
  3.  
  4. companion object {
  5. val TAG: String = OperationAdapter::class.java.simpleName
  6. }
  7.  
  8. override fun onCreateViewHolder (parent: ViewGroup, viewType: Int): Holder {
  9. return Holder (LayoutInflater.from (parent.context ).inflate (R.layout.operaitemlist , parent, false))
  10. }
  11.  
  12. override fun getItemCount (): Int = arrayList. size
  13.  
  14. override fun onBindViewHolder (holder: Holder, position: Int) {
  15.  
  16. holder.itemView.txtphonenumber.text = arrayList[position].phone
  17. holder.itemView.txttime.text = arrayList[position].etime
  18.  
  19. holder.itemView.cardview.setOnClickListener {
  20. val alertDialog = AlertDialog.Builder(context)
  21. .setTitle("My title")
  22. .setCancelable(true)
  23. .setMessage("My message")
  24. alertDialog.show()
  25. //Toast.makeText(context,"Click ${arrayList[position].id}",Toast.LENGTH_SHORT).show()
  26. }
  27. }
  28.  
  29. class Holder (itemView: View): RecyclerView.ViewHolder (itemView)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement