I want keep activity and use different layout (landscape or portrait) when rotate screen.
- layout (portrait) : there 3 textview, one is visible and other textview is gone
- layout-land : there 3 textview and all is visible
Followed best answer from here >> Activity restart on rotation Android , I put
android:configChanges="keyboardHidden|orientation|screenSize"
on my manifest and i put this code :
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.myLayout);
}
efect before put above code : Activity and data is keeped but cannot change screen layout land/portrait
after put above code : Activity is keeped, layout is changed, but data is lost
so how to solve it ?