I have an activity which handles configuration changes. But now i have to change layout.I tried in onConfigurationChanged callback just to set again the layout and hoping will get the correct layout(land) but it's still showing the first layout for portrait view ( there two layout(same name) are placed in res/ layout and res/layout-land :)
if I delete android:configChanges="orientation", it works should be, but ı need to handle onConfigurationChanged. What should I do??
If you have your portrait layout
main.xml
in/res/layout
and your landscape layoutmain.xml
in/res/layout-land
, and youronConfigurationChanged()
looks like this:And in your Manifest you should have
android:configChanges="keyboardHidden|orientation"
Then it should work fine, as this does in my app. Is this what you are doing?
See Activity.recreate() here: http://developer.android.com/reference/android/app/Activity.html#recreate()