Sync two ArrayList of Grocery and Cart matching the ID and get the Count from Cart ArrayList and display in the grocery array List?

Viewed 15

I have a Grocery ArrayList that contains JSON name and values id, name, company, quantity, instock.

I have an add button on the view holder that adds and increments the item count to the cart array list that includes all the above JSON objects id, name, company, quantity, instock and count in addition to the above one.

When I reload the activity now, the recyclerview loads only the grocery list and doesn't display the count of the items in the view holder that the user already added to the cart. I know this wouldn't happen unless you sync the grocery ArrayList with the cart ArrayList by matching the id of the product and displaying the count of that particular id to the Cart ArrayList.

0 Answers
Related