Android Question Detect Current Orientation

DawningTruth

Active Member
Licensed User
This sub will assist you to determine the current orientation of your activity.

I noticed that the solutions to this one on the forum are quite complicated or resource intensive. Here is a Sub you can use, which is very simple and uses minimal resources. Hope it helps :) someone.

B4X:
Sub DetermineCurrentScreenOrientation As String
  
    Dim orientation As String
  
    If Activity.Height > Activity.Width Then
        orientation = "portrait"
    Else
        orientation = "landscape"
    End If
  
    Return orientation
  
End Sub
 
Top