Skip to content Skip to sidebar Skip to footer

Android: Dynamically Creating Controls And Orientation Change

Currently I am working on an Android application that is dynamically creating controls. Everytime a user would click a button a new EditText appears below the button and the user

Solution 1:

Try adding this to your <activity> tag in your manifest file:

android:configChanges="orientation|keyboardHidden"

Then do this in the activity class:

@OverridepublicvoidonConfigurationChanged(final Configuration newConfig)
{
    // Ignore orientation change to keep activity from restartingsuper.onConfigurationChanged(newConfig);
}

If you do this your activity will just be reused on orientation change instead of destroyed/recreated. So you won't have to save the state of everything you have going on.

Post a Comment for "Android: Dynamically Creating Controls And Orientation Change"