Results 1 to 3 of 3
  1. #1

    Exclamation Emulator not switching back from landscape to portrait view.

    I am half-following along with the "Hello, Android" book (3rd edition) by Ed Burnette. I have added a portrait GUI layout main.xml under "res/layout/main.xml" and a landscape GUI layout under "res/layout-land/main.xml" as described in the book. When using my app under the SDK emulator, I can switch my GUI from portrait to landscape by pressing CTRL-F11. However, if I press this again, the GUI is stuck in landscape mode. I have no other code other than: -

    Code:
    package com.thenode.mobile.podgrab;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    public class PodGrabActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        }
    }
    What do I have to do to make my GUI switch back to portrait mode from landscape? Am I missing something or is this a bug in the emulator? The book makes no mention of this problem. Any advice please?

  2. #2
    Senior Member
    Join Date
    May 2011
    Posts
    245
    Blog Entries
    3

    Device(s)
    Droidx, Xoom and Comcast MIFI Hotspot
    Where did you get the code? Can you go back to the source to see if there are any updates or Fixes posted?



  3. #3
    Huh? I've given all the information. Portrait layout goes under "res/layout/main.xml", landscape layout goes under "res/layout-land/main.xml". Yet the emulator doesn't switch back from landscape to portrait after pressing CTRL-F11. I wrote the code. There is the code above - which is the only actual Java code, then there are simply two main.xml files for each orientation. XML layout files don't effect the lack of orientation switching unless I'm missing something.

    So my question still stands.

    Oh, and I might have posted this twice as I couldn't see my post show up under the site, nor my profile for recent posts - bug in the forum perhaps? Apologies for the suspected double-post anyway.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •