I am working on an Android application that is dynamically creating controls. I done this type Coding.
TextView lblTitle = new TextView(myContext);
relLayoutHeader.addView(lblTitle);
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
lblTitle.settext("LandScape");
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
lblTitle.settext("Portrait");
}
in manifest file:
android:configChanges="orientation|keyboardHidden"
when i am change orientation from portrait to landscape it works good. But from landscape to portrait application is crash down. force closed.
Any suggestion for my code?????
You need to reinitialize you view at
onConfigurationChanged.