yuraArmenian
yuraArmenian

Reputation: 29

Information disappears when I rotate the phone

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

Answers (1)

Al0x
Al0x

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

Related Questions