How to disable landscape mode?

Simonxman

Member
Hi guys i dont wanna my app to have landscape mode, if the phone rotate the app is still the same without any changes, is this possible if yes,how?

Thanks !!
 

klaus

Expert
Licensed User
Longtime User
Phone library:

From the help:

SetScreenOrientation

Method

Changes the current activity orientation. This method cannot be called from a service module.
Orientation: -1 for unspecified, 0 for landscape and 1 for portrait.

Returns : Void

SetScreenOrientation(Orientation As Int)


Best regards.
 
Upvote 0

Tom Law

Active Member
Licensed User
Longtime User
Klaus's method is the way to go:

Load the phone library

Dim Phone as Phone
Phone.SetScreenOrientation(1)
 
Upvote 0

Prosg

Active Member
Licensed User
Longtime User
i saw a lot of exemple to set orientation with the phone librarie...

but i need to know the what is current orientation ? (if it's landscape or portrait)
 
Upvote 0

trebun

Member
Licensed User
Longtime User
It's important to say, that you need this in a service ("Live Wallpaper" is a service). But, it's not possible to set the orientation on a service with a switch or the manifest.

You must draw your picture/background corresponding to portrait when landscape is detected...

Sorry, it's not a simple thing to do this on a service... ;-)

Regards,
trebun
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Beginner's Guide chapter 17.25 Detect screen orientation.
Or in the search field 'detect screen orientation' the first result gives you the solution !
B4X:
If Activity.Width > Activity.Height Then
   Orientation = "Landscape"
Else
   Orientation = "Portait"
End If
Best regards.
 
Upvote 0
Top