List adapter

PHOTO EMBED

Tue May 11 2021 16:02:40 GMT+0000 (Coordinated Universal Time)

Saved by @Lukatjee #kotlin #android

// Create an array and instantiate a listview
val myArray : MutableList<BigInteger> = mutableListOf(); val lstView = findViewById<ListView>(R.id.lsvw)

// Create an adapter and link it to the listview
val arrayAdapter : ArrayAdapter<BigInteger> = ArrayAdapter<BigInteger(this, android.R.layout.simple_list_item_1, myArray)
lstView.adapter = arrayAdapter

// Add data to the array and push it to the adapter
myArray.add(<data>)
arrayAdapter.notifyDataSetChanged()
content_copyCOPY