My ArrayAdapter data update makes my adapter empty instead of updating the data
I need to change data in ArrayAdapter when a change occurs in LiveData, so I set up an Observer:
viewModel.selectablePlayers.observe(viewLifecycleOwner, Observer {
adapter.apply {
clear()
addAll(it)
}
})
I'm sure that it contains a non-empty list, but this is giving me an empty adapter. I noticed that if i remove the clear() call the new list is added to the adapter, so I guess I'm doing something wrong with that clear() call. I...