Android Question SetScreenOrientation causing delays

JonPM

Well-Known Member
Licensed User
Longtime User
I need my app to run portrait on phones and landscape on tablets. First I determine device:

B4X:
DeviceScreenSize = Ceil(GetDeviceLayoutValues.ApproximateScreenSize)
 If DeviceScreenSize < 7 Then
     Starter.DeviceType = "Phone"
     p.SetScreenOrientation(1)
 Else
     Starter.DeviceType = "Tablet"
     p.SetScreenOrientation(0)
 End If

Then when switching activities i set the orientation:

B4X:
    If Starter.DeviceType = "Phone" Then
        p.SetScreenOrientation(1)
    Else
        p.SetScreenOrientation(0)
    End If

The problem is on my tablet (Galaxy Tab 2) there is significant delay (~2-3 secs) when switching activities. Also, as expected, it is causing Activity_Pause and Activity_Resume to be called an additional time which is throwing off some of my other code. Is there a better way to handle this? I have set the Project Attributes in Main to Portrait, as I believe majority of users will be using app on a phone.
 

JonPM

Well-Known Member
Licensed User
Longtime User
Wouldn't it cause the same issue since my Project Attributes in Main sets the orientation to Portrait?
 
Upvote 0
Top