Android Question [SOLVED] Phone library :: SetScreenOrientation

JoeR

Member
Licensed User
Longtime User
What is the SetScreenOrientation value for unspecified in the Phone library?

My app has several modules, one of which displays a map using osmdroid/mapview. Within that module (only) , I want to display an initial screen as landscape - but thereafter to "honour" the situation where a user rotates the device.

In the other modules, I want to force landscape all the time. I would like to achieve this programmatically using phone (or another equivalent) library.

I cannot use the #SupportedOrientations: parameter in Project Attributes as this applies across all modules all the time.

The Phone library documentation says:
15.png
SetScreenOrientation (Orientation As Int)

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.

The (very simple) code that I currently use is:
B4X:
Sub Process_Globals
  Dim phone1 As Phone

Sub Activity_Create(FirstTime As Boolean)
phone1.SetScreenOrientation(0)  ' force landscape for map
 

antofer

Member
Licensed User
Longtime User
Phone add the library and declare the variable
but I can not assign ownership

As p Private Phone

p.SetScreenOrientation (0) 'or 1 Depending on the orientation you need.

setScreenOrientation not exist as property

I do wrong?
 

Attachments

  • p1.png
    p1.png
    158.4 KB · Views: 247
Upvote 0
Top