title: How to get the selected item from ListView in Kotlin?
body: <p>Code Sample:</p>
  
  <pre><code>package tech.kapoor.listviewdemo
  
  import android.content.Context
  import android.graphics.Color
  import android.support.v7.app.AppCompatActivity
  import android.os.Bundle
  import android.view.View
  import android.view.ViewGroup
  import android.widget.BaseAdapter
  import android.widget.ListView
  import android.widget.TextView
  import android.widget.AdapterView
  
  
  class MainActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val listView = findViewById&lt;ListView&gt;(R.id.main_listview)
          var redColor = Color.parseColor("#FF0000")
  
          listView.setBackgroundColor(redColor)
          listView.adapter = CustomAdapter(this)
      }
  
      private class CustomAdapter(context: Context): BaseAdapter() {
  
          private val mContext: Context
  
          init {
              mContext = context
          }
  
          override fun getCount(): Int {
              return 80
          }
  
          override fun getItemId(position: Int): Long {
              return position.toLong()
          }
  
          override fun getItem(position: Int): Any {
              return position
          }
  
          override fun getView(position: Int, view: View?, viewGroup: ViewGroup?): View {
              val textView = TextView(mContext)
              textView.text = "Here comes the !!"
              return textView
          }
      }
  }
  </code></pre>
  
  <p>I'm trying to understand list view instead of recycler view to understand basics first. 
  Anybody knows how we get the selected row id/index value on selection or onclick and also how to perform some action on selection of a specific row in kotlin?</p>