How To Stop The Items Duplication In Recyclerview Android
Actually my problem is when I click the item it go to a DetailsFragment. But when I return back to my ItemListFragment the items number is increased and duplication is occurred. Pl
Solution 1:
Do this
int i = 0;
mArrayList.clear(); //Clear your array list before adding new data in itfor (String name : mNames) {
Data data = new Data(name, mPrices[i], mImages[i]);
mArrayList.add(data);
i++;
}
By doing this your data won't duplicate anymore. Try it and let me know if it work for you.
Post a Comment for "How To Stop The Items Duplication In Recyclerview Android"