0

I have an app, it uses Rxjava and Retrofit to retrieve data from backend.

after login, I will get a JSON file which includes User information (name, email, id, stripeId....). I will need to use User information when retrieving data from backend in other activities. Since there are many times I need to use the User information, saving it in Database or SharePreference may spend a lot of time.

Is there any way that I can save the data in the memory when the App is alive (not killed in the background)? Thanks first.

Xianwei
  • 2,381
  • 2
  • 22
  • 26

1 Answers1

3

You can extend Application Class which is initiated on application startup. Check it here:

Extending Application to share variables globally

Maksym V.
  • 2,877
  • 17
  • 27