My app has 3 screens, and all of them must be portrait-only in smartphones and both orientation for tablets.
Unitl now I was using the following code in OnCreate
:
if (!getResources().getBoolean(R.bool.isTablet)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
However if I hold the smartphone in landscape mode and launch the application it will show in landscape for a few seconds then rotate to portrait.
Many answers here suggest locking orientation via manifest, but that would lock the orientation in tablets, which is not desired.
I would be very grateful for any information that leads me to a solution. Thanks.