Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [QT 5.3 for Android] How to change app orientation dynamically?
Servers for Qt installer are currently down

[QT 5.3 for Android] How to change app orientation dynamically?

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    reiko
    wrote on 17 Oct 2014, 06:48 last edited by
    #1

    I know the app orientation could be setting in the androidmanifest.xml.
    But how to set app orientation dynamically by using QT code?
    PS: NOT qml app
    PS: I could do the same thing by using setRequestedOrientation() in Android Java code

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZeAL0T
      wrote on 25 Oct 2014, 21:02 last edited by
      #2

      I think you should follow the "issue":https://bugreports.qt-project.org/browse/QTBUG-38576 and add the feature request for non QML applications.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ankitlive
        wrote on 6 Nov 2014, 11:16 last edited by
        #3

        here is something for you,
        package com.exercise.AndroidOrientation;

        import android.app.Activity;
        import android.content.pm.ActivityInfo;
        import android.os.Bundle;
        import android.view.View;
        import android.widget.Button;

        public class AndroidOrientationActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

            Button buttonSetPortrait = (Button)findViewById(R.id.setPortrait);
            Button buttonSetLandscape = (Button)findViewById(R.id.setLandscape);
            
            buttonSetPortrait.setOnClickListener(new Button.OnClickListener(){
        

        @Override
        public void onClick(View arg0) {
        // TODO Auto-generated method stub
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        }});

            buttonSetLandscape.setOnClickListener(new Button.OnClickListener(){
        

        @Override
        public void onClick(View arg0) {
        // TODO Auto-generated method stub
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        }});
        }
        }

        [url=http://www.mygatenow.com/2014/10/shoe-in-money-system-review.html]shoe in money system review[/url]

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved