I'm showing my recycler view like this:
parrafoLeyViewModel.allParrafosLey.observe(this, Observer {
recyclerview_lectura_ley.layoutManager = LinearLayoutManager(this)
adapterListar = AdapterListarLey(this, it, this)
recyclerview_lectura_ley.adapter = adapterListar
})
So when I insert data into the RoomDatabase my recyclerview restarts and goes back to the start
GlobalScope.launch {
db.parrafoLeyDao().updateComentarioLey(
ComentarioLey(
idParrfo,
spTipoComentario.selectedItem.toString(),
etInserteComentario.text.toString()
)
)
}
What I want is that when I insert the data it remains in the same position. I am using ViewModel
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…