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 it
for (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.
Solution 2:
For one more help:
bundle.putInt("position", position);
bundle.putString("text", your_text_field);
...
fragment.setArguments(bundle);
...
Post a Comment for "How To Stop The Items Duplication In RecyclerView Android"