Hello, I'm developing an app and I need the screen to be in portrait for smartphones and portrait / landscape for tablets. The customer does not want to accept separate apps and does not want to leave the unlocked orientation on the smartphone. My solution was to create a bool that changes the value according to the size of the screen, but the application closes on the smartphone when it starts when the device is in the landscape. The main class extends the NoRotateScreen class, the code inside it is:
boolean tabletSize = getResources().getBoolean(R.bool.isTablet);
if (!tabletSize) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
The file that directs the boolean file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">true</bool>
</resources>
What can I do?