5
Hello, I am 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 different applications and does not want to leave the orientation unlocked on the smartphone. My solution was to create a bool that changes the value according to the screen size, but the application closes on the smartphone when starting it when the device is in Landscape. The main class extends the Norotatescreen class, the code within it is:
boolean tabletSize = getResources().getBoolean(R.bool.isTablet);
if (!tabletSize) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
The file that arrow the Boolean file is like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">true</bool>
</resources>
What can I do?
Makes a layout for mobile and another for tablet, then makes an if to see if eh a tablet or a cell phone.
– Guilherme Gregores
The client does not want to accept.
– Pedro Paulo Amorim
Peter take a look at my answer see if you understand
– Guilherme Gregores