Reputation: 29
I wrote a programm,you must fill edittext and save it in the list view but when I rotate my phone the whole information is lost.What can I do not to lose my information?
Upvotes: 1
Views: 68
Reputation: 937
The layout is reloaded on each screen rotation.
You can bypass this by doing the following:
Add this in the AndroidManifest.xml to the activity that should not be reloaded:
<activity
...
android:configChanges="keyboardHidden|orientation|screenSize"
...
</activity>
In the source code of the activity add the following method:
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
Just leave the method blank, and when the screen rotates nothing will be reloaded.
Upvotes: 1