Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

layout-land xml files does not work with onConfigurationChanged call back

I have different layouts for portrait and landscape mode and I also need to override the onConfigurationChanged() callback. But problem is when I change the phone orientation to landscape my landscape layout does not work.

Can anybody tell me is this onConfigurationChanged call back problem or something else causing that?

Any help will be appreciative.

like image 999
sajjoo Avatar asked Oct 24 '25 05:10

sajjoo


1 Answers

i also need to override the onConfigurationChanged() callback

Why?

but problem is when i change the phone orientation to landscape my landscape layout does not work.

I am going to guess that "does not work" means that the landscape layout does not take effect. This is expected behavior given what you have done.

To resolve this problem, ideally you delete android:configChanges="keyboardHidden|orientation". Putting in that attribute should be done as a last resort, and typically for activities that do not have separate portrait versus landscape layout files.

like image 56
CommonsWare Avatar answered Oct 26 '25 20:10

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!