Check for switch between landscape and horizontal

carchek

Member
Licensed User
Longtime User
Hi!
I am new member here. :)
I have a question, since I am new to Android (I know VB language). I am developing an application, that will be able to check for switch between horizontal and landscape position of the telephone. :eek:
Can you please give me any guidelines so I can learn more about it. :)
Thanks in advance,
Carchek
 

NJDude

Expert
Licensed User
Longtime User
You mean to detect if the device is in Portrait or Landscape?

If the answer is yes then you can do something like this:

B4X:
If Activity.Width > Activity.Height Then

   Msgbox("Landscape", "")

Else

   Msgbox("Portrait", "")

End If
 
Upvote 0

carchek

Member
Licensed User
Longtime User
You mean to detect if the device is in Portrait or Landscape?

If the answer is yes then you can do something like this:

B4X:
If Activity.Width > Activity.Height Then

   Msgbox("Landscape", "")

Else

   Msgbox("Portrait", "")

End If

Thank you! :) :sign0008:
 
Upvote 0
Top