M
M
Max Pleshkov2016-05-07 23:32:54
Android
Max Pleshkov, 2016-05-07 23:32:54

How to organize a shopping cart in an android app?

Hey!
How to properly organize a shopping cart in an android application?
I imagine this: I
create a cart class , then, when switching from different activities, I pass the cart state data through putExtra. Number of goods, product codes, all sorts of dates.
If in one activity the cart is replenished with goods, then I return the already changed data, etc.
Or is there a more or less correct approach than using putExtra everywhere?
PS fragments are not used in the application.
Thanks...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2016-05-08
@zzWerOk

Well, if the cart is an entity that goes through all activities (or most) - then make it a regular class, and store its instance in Application. Or even a singleton (although the instantiation will most likely remain in Application, but access will be simpler).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question