2

I am writing an app where I get all the data from the rest call and display all the data in a custom component list(based on Linear Layout) which is added to a LinearLayout. I write this code in onCreate of the activity.

The problem is when I switch activity using startActivity, and come back to the calling activity (using startActivity) then onCreate is called again. I see onPause, onStop called when I call other activity.

Is there any way that I can save the application's state?

Anthony Graglia
  • 5,355
  • 5
  • 46
  • 75
Kunal P.Bharati
  • 949
  • 4
  • 11
  • 19

1 Answers1

3

Check this question: "How do I save an android application state".

Edit: You can also avoid some calls to onCreate() by adding a

android:launchMode="singleTask"

to your Activity in the AndroidManifest.

Community
  • 1
  • 1
Macarse
  • 91,829
  • 44
  • 175
  • 230