开发者

Saving Application State in Android

I am writing an app where I get all the data from the rest cal开发者_JAVA技巧l 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜