how can it so that when a tablet is running the application, it is forced to run it in landscape and when a phone is running the application, it is forced to run it in portrait? I've managed to force it to run in lets say portrait, but then it run portrait for tablets too... Portrait mode in tablets is ugly :( Thanks
Here is my suggestion:
First try to determine the type of device using screen dimensions. You could refer to this post.
On the second step you can change the screen orientation using setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
. There is another post here.
Just set nosensor parameter for activity in manifest:
<activity
android:name=".activity.MyActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="nosensor">
By the way, some tablets may be detected as phones, for example Nexus 7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With