I found several questions regarding this and it appears that I have to correctly use onSavedInstanceState and onRestoreInstanceState methods.
My application creates an array of cards and shows them in a gridview, each grid containing a textview.
While in the app, after adding cards; if I go out of the application using the menu button, everything resumes fine after comming back. However, on orientation change all the ‘table’ is reset; all the cards have to be added again.
So, why do I loose information on screen orientation change and not on exiting and reentering the app. How can I fix that?
The mentioned methods only have this:
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
}
My onCreate method begins with:
super.onCreate(savedInstanceState);
A change in orientation of the device recreates the entire activity – calling onCreate() all over again. Whereas when you use the home button the activity is paused (onPause()) and then when it is made visible again it enters through the onResume() method. Hence anything done in onCreate() is retained.
http://developer.android.com/reference/android/app/Activity.html
I think this is probably what you are looking for
http://developer.android.com/guide/topics/resources/runtime-changes.html