Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Android Activity Lifecycle The Activity Lifecycle Retrieving Instance State

The screen's orientation is not changing

I am using Windows and CTRL + F11 is not rotating the emulator. I manually rotated the emulator using the toolbar but the layout remains in portrait mode. I started a new project and tried rotating the sample Hello World activity, but that also remained in portrait mode.

On android studio version 3.3.2 the rotation shortcuts are CTRL-left arrow and CTRL-right arrow.

I also had the rotation bug where the screen inside the emulator did not actually rotate - the workaround that made it rotate again was disabling "Enable keyboard input" in Android Virtual Device Manager -> The "Edit this AVD" icon in Actions clumn -> Show Advanced Settings.

The issue seems specific for certain device emulations ( like Nexus 5X ) on Nexus 7 tablet it rotated fine without disabling that setting.

2 Answers

Check the auto-rotate setting in the swipe-down notification bar at the top of the virtual phone is enabled.