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!");
    }
}