Guest User

Untitled

a guest
Sep 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. class SampleAdapter(context: Context, val m_resoruce:Int, val m_list:List<SampleData>)
  2. : ArrayAdapter<SampleData>(context, m_resoruce, m_list) {
  3.  
  4. private val m_inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
  5.  
  6. override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
  7.  
  8. val v = fun (view: View?): View {
  9. if (view != null) {
  10. return view
  11. }
  12. return this.m_inflater.inflate(this.m_resoruce, null)
  13. }(convertView)
  14.  
  15. val item = this.m_list[position]
  16. v.findViewById<TextView>(R.id.title).text = item.title
  17. v.findViewById<TextView>(R.id.desc).text = item.desc
  18. return v
  19. }
  20. }
Add Comment
Please, Sign In to add comment