Android Question ? GET ScreenOrientation

GMan

Well-Known Member
Licensed User
Longtime User
Is it possible to GET the actual ScreenOrientation ?

I searched the forum, but all questions belongs to SET it...

P.S.: i know that its working this way, but think maybe there is a better way:
B4X:
Dim Orientation As String
If Activity.Width > Activity.Height Then
    Orientation = "Landscape"
Else
    Orientation = "Portrait"
End If
 

GMan

Well-Known Member
Licensed User
Longtime User
I need a combination of the Accelerator +Y-Axis (away from me) and the ScreenOrientation (for users that dont have a Gyro build in).
So i used the written way and that works but thought, i can get the orientation by an own event.
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
I need a combination of the Accelerator +Y-Axis (away from me) and the ScreenOrientation (for users that dont have a Gyro build in).
So i used the written way and that works but thought, i can get the orientation by an own event.
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
Hoi Erel,

TOP - thats what i was looking for
 
Upvote 0

ivan.tellez

Active Member
Licensed User
Longtime User
This could be usefull

B4X:
Sub GetOrientation As Int
   Dim r As Reflector
   r.Target = r.GetContext
   r.Target = r.RunMethod("getResources")
   r.Target = r.RunMethod("getConfiguration")
  
   Dim Result As Int = r.GetField("orientation")
   Return Result
  
End Sub
 
Upvote 0
Top