ListAdapter no actualiza el elemento en RecyclerView: los datos cambian, pero la UI no se redibuja
¡Hola a todos! Soy nuevo en Kotlin y desarrollo Android. Estoy usando ListAdapter para RecyclerView, pero me encontré con un problema extraño: cuando cambio los datos en la lista y llamo a submitList(), los elementos no se actualizan en la pantalla. Aquí está mi código:
```kotlin
data class Item(val id: Int, var title: String, var isCompleted: Boolean)
class ItemDiffCallback : DiffUtil.ItemCallback- () {
override fun areItemsTheSame(oldItem: Item, newItem: Item): Boolean {
return oldItem.id == newItem.id
}
override fun areContentsTheSame(oldItem: Item, newItem: Item): Boolean {
return oldItem == newItem
}
}
class ItemAdapter : ListAdapter
- (ItemDiffCallback()) {
// ... ViewHolder y bind
}
// En Activity
val items = mutableListOf(
Ite
No answers yet.
Inicia sesión para dejar una respuesta