Android - Save activity state when starting new activity?

I know I could use the Bundle savedInstanceState to manually save and restore the state by overriding onPause, onResume, on Create (etc), but there is actually lots of data in custom components that are not easily serializable, so I'd like to avoid that What you would "like" does not much matter. You need this code anyway to handle configuration changes (e.g. , switch from portrait to landscape). Please implement onSaveInstanceState() and onRestoreInstanceState() then back out all the rest of the inappropriate hacks that you have in your previous paragraph (e.

G singleInstance alwaysRetainTaskState ).

I know I could use the Bundle savedInstanceState to manually save and restore the state by overriding onPause, onResume, on Create (etc), but there is actually lots of data in custom components that are not easily serializable, so I'd like to avoid that. What you would "like" does not much matter. You need this code anyway to handle configuration changes (e.g. , switch from portrait to landscape).

Please implement onSaveInstanceState() and onRestoreInstanceState(), then back out all the rest of the inappropriate hacks that you have in your previous paragraph (e.g. , singleInstance, alwaysRetainTaskState).

Well, obviously, what I "like" is dictated by the application imperatives. About those "inapropriate" hacks, maybe I'm missing the point, but why would they be inapropriate? Are they like things to avoid?

Seems pretty neat to me, but, once again, maybe I miss some information. And if I can get the behavior I want from them when I go back to home screen and to the application again, is it really bad to think that I could find the same kind of thing if I start the application from my activity? – Ours Feb 2 at 13:08 @Ours: "Are they like things to avoid?" -- the documentation explicitly states that singleInstance is "not appropriate for most applications", with the quoted passage highlighted in red.

AlwaysRetainTaskState="true" is fine for its intended purpose, but it is not supposed to be some sort of panacea for properly saving your instance state. – CommonsWare Feb 2 at 13:20 Ok. Doesn't mean it's not appropriate in my case.

And all of that doesn't solve my problem. Anyway, thanks for your answer and advices. – Ours Feb 2 at 13:29.

While doing that, he should be able to take a picture, save it, and return to the previous activity. I'm having the following problem : when the user goes back to the activity after taking the picture, the progress (basically, the items selected) is lost. I tried to use android:launchMode="singleInstance" (as well as singleTask) and android:alwaysRetainTaskState="true" on my activity to save its current state (and it works great when the user leave the application to do something else, then come back later to it).

I tried to lunch the ACTION_IMAGE_CAPTURE intent with the FLAG_ACTIVITY_NEW_TASK to simulate the same behavior (somewhere in my mind I thought it should be the same thing as lunching the picture activity from the homescreen), but with no effect. I even tried to lunch the picture activity with startActivityforResult with the hope that somehow my activity wouldn't be lost, but with still no effect. I know I could use the Bundle savedInstanceState to manually save and restore the state by overriding onPause, onResume, on Create (etc), but there is actually lots of data in custom components that are not easily serializable, so I'd like to avoid that.

Well I guess my question is how can I reproduce the same behavior as alwaysRetainTaskState manifest attribute? Or is there anyway to easily save the state of my activity? Or what am I doing wrong, missing the obvious?

Thanks a lot!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions