Android emulator bug while changing orientation


Hi,

In documentation, it has been stated that when we change orientation, it destroys Activity and restart it. It is expected because applying new configuration causes recreation of UI view.

Android has different emulators depending on the SDK versions. For example 1.5, 1.6 2.1 update 1, 2.2, 2.3 etc.

I noticed that in 2.3 version, when you change the orientation first time, it restarts your current activity and recreate you view. When you again change the orientation, it restarts the Activity but it does not display correct layout (landscape/portrait). see

I perform the same test on 1.5 and 2.1 update1. Here I get the strange output!  Changing the orientation from portrait to landscape, it restarts your activity and shows correct layout, While changing the orientation from landscape to portrait it restarts your activity twice and  shows correct layout.

To test the bug, just create a project from eclipse with myTest activity and write a line to display in LogCat.

Example:

public class myTest extends Activity {    
/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        System.err.println("Test Activity created!");
    }
}
About these ads

2 thoughts on “Android emulator bug while changing orientation

  1. Illia Bobyr

    Same here on x86 emulator running Intel Atom x86 image, Android 2.3.3.
    Only the first orientation change seems to be doing anything. Then the application is suck in the landscape layout. I have not looked if the activities are reconstructed after the first orientation change.

    This is annoying. I have to invoke a capture activity that will change the orientation on its own. After that my application is stuck in the landscape layout.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s