Android: are there cases when an Activity is re-created even when “android:configChanges=” set to everything?

If you are asking this, your app is probably broken.

If you are asking this, your app is probably broken. So -- why do you care? If you can't handle your activity being restarted, then you will break in the situation where your app's process needs to be killed for memory while in the background and the user later returns to it.

If you can handle being restarted, why do you care that there may be some case where the activity needs to be restarted? Anyway the answer is that there is no way to guarantee that the activity is never restarted, so don't abuse android:configChanges to try to avoid that. You can't prevent it, you just make it less obvious to yourself that your app is broken, but users will still encounter the bugs you have.

If you are having trouble dealing with this, consider using some recent facilities like fragments and loaders in the new support library. These have a number of features that make it easier for apps to handle their activity being restarted -- fragments can be retained across restarts, loaders keep their data loads active, etc. Also the set of possible reasons that an app may need to be restarted is not fixed. New changes can and will be added in the future, and you can't account for them.

– JBM May 31 at 16:53 I've looked into Loaders and it's said that they handle configuration change automatically - very nice, but there is one problem: Loaders are available since API 11 and I have to support APIs 3+. Is there a way to achieve the same using API 3 facilities? I appreciate your answer very much.

– JBM May 31 at 17:08 @JBM: Loaders are in the Android Compatibility Library. – CommonsWare May 31 at 18:20.

Usually, when you want some objects to remain accross activity recreation, you should make them depend, not on the activity, but on the application context. If your application object, as recommended, is a singleton, then it would be much easier to make your items survive to the activity life cycle. Here is an exemple on how to do that : Android: How to declare global variables?

And for dialogs, I don't know exactly how they can be handled, I am looking for more information from other members on this thread. – Snicolas May 31 at 16:34.

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