Using one linear recyclerview, when I update the list data lets say from meters to centimeters and calling notifyDataSetChange() on adapter afterwards, it changes/shuffles the position of items(edittexts inputs for numbers) in recyclerview. How can I prevent the list from shuffling and retaining the same position for converted items? Is Diffutill recommended for this to work?
stackoverflow 2
u
Umar Ata
02/02/2021, 7:39 AM
Are you using hashmap? If yes then use linkedhashmap it remains the order as the data inserted
👍 2
a
Aness Iqbal
02/02/2021, 7:44 AM
No, I am using simple array list. I am just recalculating the results in adapter class but the some edittext values get swaped. I need to make sure the consistent UI to the user.
u
Umar Ata
02/02/2021, 7:46 AM
If you are storing edittext values from list and setting it to edittext in onbindviewholder so it will work
If you are using edittext for storing values so when you scroll it definitely swap values