For my main activity, I have got two layout files. One is for portrait mode and the other one for landscape mode.
These are the locations of my xml files.
For portrait mode:
res/layout/activity_main.xml
For landscape mode:
res/layout-land/activity-main.xml
I have tested these configurations and they work perfectly on higher Android devices. The problem is that, for example, on Android 1.6 the app crashes when switching to landscape mode.
What’s wrong here? Is there a workaround for that?
change the name of the xml file in layout-land to
The names are not matching, hence the error. Change it from
activity-main.xmltoactivity_main.xml(replace hyphen with undescore). You should be fine now.