Android Question #SupportedOrientations

IanMc

Well-Known Member
Licensed User
Longtime User
When I set it to Portrait it works great but I'd like it to change to right way up when I turn the device 180degrees.

I have an ebook reader called moonreader which does this so I know its possible.

Is there a way to do it in B4a?
 

IanMc

Well-Known Member
Licensed User
Longtime User
Sounds good, I'll give it a try thanks!

Yep works!

How cool, NJ nails it again.

B4a is so cool!

btw... any idea what it does in those rare cases? does it still lock to portrait?
 
Last edited:
Upvote 0

IanMc

Well-Known Member
Licensed User
Longtime User
Thank you person with unpronounceable name :)

but as NJ advised, in the project I did this:

B4X:
#Region  Project Attributes
    #ApplicationLabel: Android Looper
    #VersionCode: 1
    #VersionName: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: sensorPortrait
    #CanInstallToExternalStorage: False
#End Region

used the sensorPortrait attribute and it works a charm.
 
Upvote 0

picenainformatica

Active Member
Licensed User
Longtime User
I think that sensorportrait dont works in phones (avoiding invert mic and speaker). So i use .setscreenorientation(9).
 
Upvote 0

IanMc

Well-Known Member
Licensed User
Longtime User
Ah! I'll just try it on my phone... stand by...

It works on my phone but my phone is a bit of a special one.

I hope that if it doesn't work on some devices then it just locks it to portrait even if its upside down when you turn it 180degrees.
 
Upvote 0

picenainformatica

Active Member
Licensed User
Longtime User
In devices that not rotate upside down i can turn screen with that comnand.
 
Upvote 0

IanMc

Well-Known Member
Licensed User
Longtime User
Cool and thank you

I'll try it like this then if I encounter problems I'll re-visit it.
 
Upvote 0
Top