Android Question Lock screen rotation only for certain activities - how?

ThePuiu

Active Member
Licensed User
Longtime User
Is it possible to block the screen rotation only for certain activities?
 

JohnC

Expert
Licensed User
Longtime User
You can also programmically force an orientation for an activity using code.

(call this sub from code in the activity you wish to orient)

B4X:
Sub SetScreenOrientation(LandScape As Boolean, Reverse As Boolean)
     'ReverseLandscape (8) and ReversePortrait (9)
    Dim MyPhone As Phone
    If LandScape = False Then
        If Reverse = False Then
            MyPhone.SetScreenOrientation(1)            'portrait
        Else
            MyPhone.SetScreenOrientation(9)            'portrait
        End If
    Else
        If Reverse = False Then
            MyPhone.SetScreenOrientation(0)
        Else
            MyPhone.SetScreenOrientation(8)
        End If
    End If
End Sub
 
Upvote 0
Top