Android Question Change orientation

Discussion in 'Android Questions' started by yiankos1, Jun 14, 2015.

  1. yiankos1

    yiankos1 Active Member Licensed User

    Hello my friends,
    I want to ask you if there is anyway out there to change the orientation of the screen without enable the auto-screen orientation
    Code:
    If rotate.GetAutoRotateEnabled=0 Then
        rotate.SetAutoRotateEnabled(
    1)
    End If
    Thanks in advance!
     
    Last edited: Jun 14, 2015
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    yiankos1 likes this.
  3. yiankos1

    yiankos1 Active Member Licensed User

    Thank you very much for quick reply, but i mentioned above, that i want another way than this one:
    Code:
    If rotate.GetAutoRotateEnabled=0 Then
        rotate.SetAutoRotateEnabled(
    1)
    End If
    cause i don't want to enable that setting to user, if he doesen't enabled that setting by his own.
    So you gonna say me, enable auto screen orientation at Activity_resume and disable it at Activity_pause but that leads to loop when rotating phone. Cause, when phone rotates, activity first pauses and then activity resumes and does not work!
     
  4. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Hi @yiankos1 you have misunderstood. With the phone library you can set which ever orientation you want by code. You don't need to set the auto rotate mode at all, just leave it set to whatever the user has chosen. But if your Application requires landscape for one activity just call the setscreenorientation. See my previous link for its implementation.
     
Loading...