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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:52:58+00:00 2026-05-28T14:52:58+00:00

<script> document.addEventListener(orientationChanged, updateOrientation); function updateOrientation(e) { switch (e.orientation) { case 0: // Do your

  • 0
<script>
document.addEventListener("orientationChanged", updateOrientation);

 function updateOrientation(e) {
    switch (e.orientation)
    {   
        case 0:
            // Do your thing
            break;

        case -90:
            var ele=document.getElementById("photoBox")
            ele.width='200px';
            ele.height='200px';
            ele.style.float='center';
            break;

        case 90:
             var ele=document.getElementById("photoBox")
                ele.width='200px';
                ele.height='200px';
                ele.style.float='center';
                break;
        default:
            break;
        }
    } 
</script>

I have used this is code for the Gallery in my application. The problem that i am facing is, whenever I change the orientation of the device, the images disappear. I do not get any error message in the logcat.

I am very specific about the code being in javascript. Inspite of me using it for android, i cant make any changes on the native side.

Any help is appreciated.
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-28T14:52:59+00:00Added an answer on May 28, 2026 at 2:52 pm

    you can do this by adding “configChanges” attribute in your activity in AndroidManifest.xml as follows

    <activity
            android:configChanges="orientation|keyboard"
            android:name=".MyActivity">
     </activity>
    

    and in your activity(MyActivity.java) please override the method “onConfigurationChanged(Configuration configuration)” as follows

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    }
    

    This should solve your problem

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

Sidebar

Related Questions

Here is the code: <script> document.getElementById('btn').addEventListener('mousedown',(function(){ console.log('code'); })); </script> <input id=btn type=button onmousedown=console.log('button')> Which
I found this script: <script language=Javascript TYPE=text/javascript> var container = document.getElementById('dl'); var seconds =
i have an index.html file that holds: document.addEventListener(deviceready,onDeviceReady,false); function onDeviceReady(){ var deviceuid = device.uuid;
I've got a script with a DOMContentLoaded event handler— document.addEventListener('DOMContentLoaded', function() { console.log('Hi'); });
why does this work.. <script type=text/javascript> <!-- function myAlert(){ alert('magic!!!'); } if(document.addEventListener){ myForm.addEventListener('submit',myAlert,false); }else{
I' m trying to enable adding/deleting rows to/from table using folowing code: Script: $(document).ready(function()
I've got this script on my website : $(document).ready(function() { function filterPath(string) { return
I need a java script function that converts the document object of the current
I have the following within an XHTML document: <script type=text/javascript id=JSBALLOONS> function() { this.init
Look this code: <script type = text/javascript> function mouseClick (container) { container.appendChild (document.createTextNode (Can

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.