I am trying to setup activity screen orientation with values from XML file in res/values. I would like to do that because, more or less, I need same Activity for both tablet (landscape) and smartphone (portrait).
First try
Manifest:
<activity android:name="..." android:screenOrientation="@string/defaultOrientation"/>
config.xml:
<string name="defaultOrientation">portrait</string>
But with this setting application won't appear on device and it will return this error:
java.lang.NumberFormatException: Invalid int: "portrait"
Second
OK, so I simply changed it to this
Manifest:
<activity android:name="..." android:screenOrientation="@integer/defaultOrientation"/>
config.xml:
<integer name="defaultOrientation">1</integer>
I used 1 because ActivityInfo.SCREEN_ORIENTATION_PORTRAIT == 1.
But this is not working either. It seems that I may modify some values like application / activity name but not screen orientation ?
I know that I may workaround it by code but for some reason it feels that this also should be obtainable by XML values file.
It is somehow possible to achieve it by XML values ?