SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.apppppp.trylistview
  2.  
  3. import android.support.v7.app.AppCompatActivity
  4. import android.os.Bundle
  5. import android.widget.ListView
  6.  
  7. class MainActivity : AppCompatActivity() {
  8.  
  9.     override fun onCreate(savedInstanceState: Bundle?) {
  10.         super.onCreate(savedInstanceState)
  11.         setContentView(R.layout.activity_main)
  12.  
  13.  
  14.         val list = findViewById<ListView>(R.id.clockList)
  15.         val adapter = TimeZoneAdapter(this)
  16.  
  17.         list.adapter = adapter
  18.  
  19.         list.setOnItemClickListener { _, _, position, _ ->
  20.  
  21.             val timeZone = adapter.getItem(position)
  22.             println(timeZone)
  23.         }
  24.  
  25.     }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top