On the emulator, once in a while (1 in 10 times maybe), you get two onCreate's fired on screen rotation. The 2nd one has no proper saved instance data. This is not an issue, since it's just the emulator.
Testing on Nexus One: During normal orientation change, I cannot cause two onCreate events in a row like in the emulator. BUT, if I very quickly flip the phone between landscape/portrait, the system seems to get confused and calls onCreate() without its saved instance data, just like on the emulator does. When I say "without saved instance data", I don't mean that the Bundle is NULL, but instead that it's empty or incomplete -- haven't investigated it to that level of detail yet. While flipping the phone that quickly is not a completely normal usage scenario, it can happen quite easily if you use the phone laying on your side. I think this is a very serious (race condition) problem that can lead to potential data corruption in every application. On Jan 5, 2:24 am, Business Talk <[email protected]> wrote: > It's not just 1.6. the higher versions do the same. It looks like > rotation does more than just updetes the UI. I also failed to find any > reference to this problem. > > On Jan 4, 8:16 am, Pawel Kapala <[email protected]> wrote: > > > > > Hello. > > > With following simple code (on clean, new android project): > > > public class RotationTest extends Activity { > > > private static final String LOGTAG = "RotationTest"; > > > @Override > > public voidonCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > Log.d(LOGTAG, "onCreate():"); > > } > > > @Override > > protected void onDestroy() { > > super.onDestroy(); > > Log.d(LOGTAG, "onDestroy():"); > > } > > > } > > > theonCreate/onDestroy pair is called twice when rotating from > > landscape -> portrait on Android 1.6 emulator. > > > Here is the snippet of LogCat (doing rotation to landscape and back to > > portrait): > > 01-04 14:05:35.895: DEBUG/RotationTest(704):onCreate(): > > 01-04 14:13:53.514: DEBUG/RotationTest(704): onDestroy(): > > 01-04 14:13:53.916: DEBUG/RotationTest(704):onCreate(): > > 01-04 14:14:02.035: DEBUG/RotationTest(704): onDestroy(): > > 01-04 14:14:02.604: DEBUG/RotationTest(704):onCreate(): > > 01-04 14:14:02.716: DEBUG/RotationTest(704): onDestroy(): > > 01-04 14:14:03.015: DEBUG/RotationTest(704):onCreate(): > > > On the other hand, when running the application on the G1 phone, the > > problem does not occur, when the keyboard is slid (then the rotation > > changes). > > > I've tried to find an open issue or a similar thread but I am yet > > unsuccessful. > > > Could anyone give a pointer or a description of this behavior? > > > Has anyone experienced it on Eclair or later(!) ?- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

