Force Screen rotation

cellicom

Member
Licensed User
Longtime User
Hi all,
There is a way to force the screen rotation from landscape to portrait or viceversa?

OR

There is a way to turn on/off the automatic screen rotation?

OR

There is a way to link the System display settings with a button for example? (that allow the user turn on/off the automatic screen rotation, manually)

I hope you understand me, i'm not english.
Thanks you a lot!
:sign0098:

Angelo :D
 

cellicom

Member
Licensed User
Longtime User
Thank you for your reply.

Yes i Know, but my app have both orientation.
I want to allow the user to switch. See attacched files

I want to force rotate by code when the user click in the button.
do you understand what i mean?

Thank you
Angelo
 

Attachments

  • horiz.jpg
    horiz.jpg
    71.4 KB · Views: 485
  • vert.jpg
    vert.jpg
    55.2 KB · Views: 492
Upvote 0

NJDude

Expert
Licensed User
Longtime User
You will need to do something like this:
B4X:
p.SetScreenOrientation(0) 'Landscape
p.SetScreenOrientation(1) 'Portrait
p.SetScreenOrientation(-1) 'Both

You can put the line you need on a button or something, say you want to change to Portrait when clicking on a button, so, you should do this:
B4X:
Sub Button1_Click

    Dim p As Phone

    p.SetScreenOrientation(1)

End Sub
 
Upvote 0

cellicom

Member
Licensed User
Longtime User
You will need to do something like this:
B4X:
p.SetScreenOrientation(0) 'Landscape
p.SetScreenOrientation(1) 'Portrait
p.SetScreenOrientation(-1) 'Both

You can put the line you need on a button or something, say you want to change to Portrait when clicking on a button, so, you should do this:
B4X:
Sub Button1_Click

    Dim p As Phone

    p.SetScreenOrientation(1)

End Sub

Thanks for the reply
I Tried this code, but has no effect.
 
Upvote 0
Top