I am having real problems with the Android 1.5 Activity Lifecycles, and I don't know how you guys manage these.
Well I have an Application with two activities: My MainActicity and a SettingsActivity.
I got rid of all the memory leaks when changing the orientation. The Program gets distroyed correcktly in my onDistroy() method.
In my onPause() method I stop my active networkconnections (I use soap websevces to get data) but do not distroy the environment...
Here is my Problem:
If I press the Home-Key while my app is started, onPause() and onStop() are called, the app gets paused correctly. --> I see the Home Screen.
If I hold the Home-Key down now and select my app in the popup menue onRestart, onStart and onResume are called. My App gets displayed again and everything is fine.
BUT if I do not access my App this way, but instead press my app icon on the Home screen the following happenes:
EVENTHOUGH my App is already started and still running the
onCreate() Method is called and my Acivity gets fully reloaded, eventhough it is loaded already.
So now my activity is running two times and if I do that a couple of times of course I'll run into memory problems.
now how do I solve this Problem?
Obviously I have to stop my Activity from loading more than once.... This would be easy if I could determine if an instance is running in the OnCreate() Method, but I can't find a way of doing this.
How do you solve this problem?