Reputation: 2116
In my app, in the OnCreate method, I create a list(using an add button) or I fetch it from a saved file. My function works fine and I am able to create and fetch the list until I rotate the phone(vertical -> horizontal). The list then disappears. I am still able to click the buttons on screen, but it seems I have no items in the list.Any help appreciated. Thank You in advance.
Upvotes: 1
Views: 968
Reputation: 527
It would be wise if you would add screenSize at android:configChanges="keyboardHidden|orientation" aswell i.e android:configChanges="orientation|keyboardHidden|screensize"
Upvotes: 0
Reputation: 13501
add this tag in Activity tag in manifest
android:configChanges="keyboardHidden|orientation"
and add this in activity code
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
in the same activity..
this happens because each time your screen orientation is changed onCreate()
method of the Activity will be called every time
Upvotes: 7