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 7526173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:46:01+00:00 2026-05-30T03:46:01+00:00

The desired behaviour is this: On rotation the layout is reconstructed – in order

  • 0

The desired behaviour is this:

  • On rotation the layout is reconstructed – in order to fit new screen size. Reconstruction is done with JQuery and maths – not CSS.

  • The scripts state must keep the same, also running timers, etc. These should continue like nothing happened.

In order to achieve this I made this:

  • Added android:configChanges=”orientation|keyboardHidden” to all activities in the manifest, to handle orientation change myself (note: I’m not targeting certain API, so I suppose it defaults to API 1. This means that add screenSize to configChanges is not necessary).

  • Added a listener for orientationchange:

    window.onorientationchange = function() {
    var orientation = window.orientation;
    switch(orientation) {
    case 0:
    updateScaling();
    break;

        case 90:
            updateScaling();
            break;
    
        case -90:
            updateScaling();
          break;
      }
    }
    

updateScaling only adjusts the layout.

And this works sometimes, but sometimes the device crashes (emulator as well as real device). On the emulator’s log I see this warning:

WARN/ActivityManager(73): Launch timeout has expired, giving up wake lock!

I made research and found add a longer loadUrlTimeoutValue in the activity could help, and well, I added super.setIntegerProperty(“loadUrlTimeoutValue”, 60000); to the main activity but as expected doesn’t help either.

I found many people complaining about rotation problems with PhoneGap. Is maybe the Framework just buggy for this aspect? I tested also with Apple devices, and there I was not even possible to catch the rotating event – the iPhone emulator didn’t even change the orientation, the iPad changed it but the event handler is not called and the layout keeps the same size. I tried using a workaround I found attaching a listener to document. But it didn’t help either.

Is there a fully reliable way to reconstruct the layout when rotating the device? If not, can I disable rotation after the app being initialized with a certain one (that means, I don’t want to fix to portrait or landscape – I want the application disables rotation changes after it was initialized using the current one). Is there a reliable way to do this?

Thanks

  • 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-05-30T03:46:02+00:00Added an answer on May 30, 2026 at 3:46 am

    I’m not quite sure if this fixed the crash problem, or something else I did “on the way”.

    But I added a listener which works reliably – at least on Android:

    $(window).resize(function() {
        updateScaling($('body').width());
    }); 
    

    It’s always called and passes correct width. As far as I remember it also works with screen.width

    In updateScaling I calculate a scalingFactor and adjust my elements.

    I removed window.onorientationchange.

    Note: It might be that at the point of time of the crashes I had android:configChanges=”keyboardHidden” instead of android:configChanges=”orientation|keyboardHidden” in the manifest. AFAIK this means the system reconstruct the activity, this could explain the timeout. But in that case I don’t know why super.setIntegerProperty(“loadUrlTimeoutValue”, 60000); didn’t help.

    Conclusion

    $(window).resize in combination with android:configChanges=”orientation|keyboardHidden” is working for me.

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

Sidebar

Related Questions

Here is my desired transaction order: User1 select field, perform operation, update with new
I found this code to achieve the desired effect and tried it on JSFiddle
I can have an extension method like this: DateTime d = new DateTime(); d
I have an existing JPA (EclipseLink) project where the desired behaviour is that if
Desired Workflow First I wish to fetch a particular set of questions and answers
Suppose I have the following (desired) folder structure: *CommonProject *Project#1 ----> CommonProject(link) *Project#2 ---->
My application uses lseek() to seek the desired position to write data. The file
These 4 queries produce the desired result, however I want to wrap these queries
I want to create super script for desired text selected by user. I found
I have an application with the desired functionality. Howerver, at certain times toasts are

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.