Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8070607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:26:19+00:00 2026-06-05T13:26:19+00:00

I have an application which i try to dev with the sencha touch 2

  • 0

I have an application which i try to dev with the sencha touch 2 framework on android and iphone.
I want the application orientation to be set as portrait only except for one view.
This view will load a portrait view if device orientation is “portrait” or landscape view if device orientation is “landscape”

For the moment i’m using phonegap on android where i have fixed the orientation as portrait.

But i’m quite lost when it come to create the view which will load either “portrait view” or “landscape view” depending on orientation.
Also will orientation be detected if i stick orientation to portrait in phonegap ?

Thanks for you help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:26:21+00:00Added an answer on June 5, 2026 at 1:26 pm

    Without any answer from my question i’ll answer to myself.

    On Android (phonegap) for example, define in the manifest the orientation as :

    android:screenOrientation=”sensor”

    Then, before starting the application in the Activity, if you want the application to use Portrait only set it to portrait :
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    super.loadUrl(“file:///android_asset/www/index.html”);

    In you JS, when you want to get landscape/portrait to be used, send a command to the main application with an action calling a custom setOrientation code :

    onSetOrientationSuccess: function(result) {
        ...
    },
    onSetOrientationError: function(err) {
        ... 
    },
    
    setOrientation: function(orientation) {
    
        PhoneGap.exec(this.onSetOrientationSuccess, this.onSetOrientationError, "OrientationPlugin", orientation, []);
    },
    

    OrientationPlugin is just a simple phonegap plugin where you will check the action and call the right code :

    public class OrientationPlugin extends Plugin {
    
    public static final String ACTION="undefined";
    
    @Override
    public PluginResult execute(String action, JSONArray data, String callbackId) {
        Log.d("OrientationPlugin", "Plugin called");
        PluginResult result = null;
        YourActivity activity = (YourActivity) this.ctx;
        Log.d("OrientationPlugin", "Plugin Got context");
    
        if (ACTION.equals(action)) {
            Log.d("OrientationPlugin", "Plugin set SCREEN_ORIENTATION_SENSOR");         
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
        }
        else {
            Log.d("OrientationPlugin", "Plugin set SCREEN_ORIENTATION_PORTRAIT");               
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);         
        }
        Log.d("OrientationPlugin", "Plugin set ALL OK");            
        result = new PluginResult(Status.OK, "ok");
        return result;
    }
    

    }

    Then you can always set it back to PORTRAIT whenever you need it from JS.

    Hope that help !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application in java, in which i try to ensure that the
I have a JSON which I get from web application. I try this parse
I have an application which is of size 130MB. when i try to install
Background: I have started Android recently. I want to make an application for Android
We have a C++ application for which we try to improve performance. We identified
Hai i have a application which is try to load the swf,but i cannot
Lets say I have an old application which will try to load an external
I have a Spring Framework based application which we have previous deployed successfully and
We have an application which is set up on IIS7 on Server 2008 R2
I have an application which doesn't use ARC. Now I want to integrate twitter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.