title: Kotlin ListView item click based on String
body: <p>Is there a way to check which string was clicked within a simple <code>ListView</code>? I want something different to happen for each item in this <code>ListView</code> (when clicked) but I've not seen any relevant/helpful tutorials. I understand that a <code>when</code> block would be necessary for this but unsure of the best way to implement it.</p>
  
  <pre><code>class MainActivity : AppCompatActivity() {
  
      var array = arrayOf("Melbourne", "Vienna", "Vancouver", "Toronto", "Calgary", "Adelaide", "Perth", "Auckland", "Helsinki", "Hamburg", "Munich", "New York", "Sydney", "Paris", "Cape Town", "Barcelona", "London", "Bangkok")
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val adapter = ArrayAdapter(this,
                  R.layout.listview_item, array)
  
          val listView:ListView = findViewById(R.id.listview_1)
          listView.setAdapter(adapter)
  
          listView.onItemClickListener = object : OnItemClickListener {
  
              override fun onItemClick(parent: AdapterView&lt;*&gt;, view: View,
                              position: Int, id: Long) {
                      ????
              }
          }
  
      }
  } 
  </code></pre>
  
  <p><strong>listview_item.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      android:id="@+id/relativelayout_listitem"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:gravity="top"
      android:baselineAligned="false"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;TextView android:id="@+id/listitem_title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:ellipsize="marquee"
          android:layout_below="@id/ll_title"
          android:fadingEdge="horizontal" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>