I want my application to exclusively run in portrait mode. I have tried different approaches :
- declare
android:screenOrientation="portrait"
in the AndroidManifest file : seems useless. - put
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
: prevents the application from changing to landscape mode when the phone is rotated to landscape mode after the start of the application but is unable to start the application in portrait mode when the phone is in landscape mode (in fact, the application crashes).
How can I do to always have my application run in portrait mode, no matter the orientation of the phone when the application is started?
Thanks in advance for the time you will spend trying to help me.