I am trying to get the properties from the list of objects and put them to the textView. I know how to get one property by the index with get(), but is it possible to retrieve all the text properties from the list and put them to the string in one line?
val listObserver = Observer<List<Word>?> { newName ->
// Update the UI, in this case, a TextView.
testObject.text = viewModel.listForQuiz.value?.get(5)?.text.ToString()
}
here is the object class
data class Word(val lang:String,
val text:String,
val translations:List<Translation>){
get(), usejoinToString(", ", Word::text). The first argument is whatever String you want to put between entries.