Skip to content

Instantly share code, notes, and snippets.

@dandvl
Last active October 1, 2019 01:03
Show Gist options
  • Save dandvl/230a7881203ab137ae32bdcd7995dbe5 to your computer and use it in GitHub Desktop.
Save dandvl/230a7881203ab137ae32bdcd7995dbe5 to your computer and use it in GitHub Desktop.
//ONE
var listaObjetos = mutableListOf("uno", "dos", "tres")
var adaptador = ArrayAdapter(this, R.layout.prueba,R.id.textView, listaObjetos)
spinner.adapter = adaptador
//TWO
spinner.adapter = ArrayAdapter.createFromResource(this@MainActivity, R.array.arreglo, android.R.layout.simple_spinner_item)
spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>, view: View,
position: Int, id: Long) {
Toast.makeText(this@MainActivity, parent.selectedItem.toString(), Toast.LENGTH_SHORT).show()
}
override fun onNothingSelected(parent: AdapterView<*>) {}
}
//CURSOR
//CUSTOM
//RECYCLER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment