I'm trying to make a cart like in grofers.
Expected: When I add items to cart by clicking on add button, go to other page and come back. The items which are in cart should have the quantity selected and other items should have add button with them.
Actual: When I add items to cart by clicking on add button, go to other page and come back.
Problem:
Can someone help to solve this please? Thankyou
There's a simple trick to achieve this!
You can create a getter setter class with an temp array. And declare it has static in the adapter class. So whenever you are adding the quantity add that in the temp list too and everytime while setting up data in bind method check if that item exist in the temp list. If it's there than set the quantity from that temp list. If there's no I'd present in list than your default state would be displayed.
Check this out! If you get any problem while doing above code, let me know.