When the Android screen switches, the current activity is destroyed, and the data on the activity will be lost.
If the checkbox for each item above is ListView, the check box will lose all selected information when the screen is switched.
Solution 1: Add android:configchanges= "Orientation|keyboardhidden" to Androidmanifest.xml's activity tag
<activity
android:configchanges= "Orientation|keyboardhidden"
android:label= "Sqltest"
android: Name= ". SqlData "
</activity>
Solution 2: force limit activity in horizontal screen state or vertical screen state, do not allow activity to switch at the same screen
Landscape means horizontal screen
Portrait represents the vertical screen
<activity
android:label= "sqltest"
android:name= ". SqlData "
android:screenorientation=" Landscape ">
</activity>
Solution 3: in activity, through replication . onconfigurationchanged method, to achieve the different screen state of the processing mode.
@Override public
void onconfigurationchanged (Configuration newconfig) {
//TODO auto-generated stub
super.onconfigurationchanged (newconfig);
* * Horizontal screen detection
/
if (This.getresources (). GetConfiguration (). Orientation
= = Configuration.orientation_landscape) {
//current for horizontal screen
//implementation Code
}
else if (this.getresources (). GetConfiguration (). Orientation
= = configuration.orientation_portrait) {
//current for vertical screen
//implementation Code
}
* * Entity keyboard status Detection
/if (newconfig.hardkeyboardhidden
= = Configuration.hardkeyboardhidden_ NO) {
//entity keyboard in Eject State
//implementation Code
}
else if (newconfig.hardkeyboardhidden
= = Configuration.hardkeyboardhidden_yes) {
//entity keyboard is in close State
//implementation Code
}
author:conowen@ Big Clock
Original address: Http://blog.csdn.net/conowen
This is the entire content of this article, I hope to learn more about Android software programming help.