Kunal P.Bharati
Kunal P.Bharati

Reputation: 969

Saving Application State in Android

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?

Upvotes: 2

Views: 404

Answers (1)

Macarse
Macarse

Reputation: 93143

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.

Upvotes: 3

Related Questions