0

I'm working on app that has 3 activities:

  • one has a list of items,
  • the second has the details of the item (price, quantity, name) and add to cart button,
  • the third has a list of items including the price, quantity and total price.

My question is: how can I send the value to the 3rd activity and keep updating the list every time I click on "add to cart" button without launching the activity, since the only way to launch it through activity 2 by pressing on "cart" button.

Bruno
  • 3,872
  • 4
  • 20
  • 37
Brimo
  • 21
  • 1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – tareq albeesh Jun 01 '22 at 09:57
  • Make use of [LiveData](https://developer.android.com/topic/libraries/architecture/livedata). Perhaps [this SO question](https://stackoverflow.com/q/10996479/12749998) gives you some sight. – Kozmotronik Jun 01 '22 at 12:45

1 Answers1

0

It's a false problem.

You don't have to think about activities, as Activity is just a representation of your data. Instead, you have to think about a basket object, containing a list of quantified items. This basket is updated from your 2nd activity, as far as I understand, and is displayed in your 3rd one.

Bruno
  • 3,872
  • 4
  • 20
  • 37