Monday, January 4, 2010

[android-developers] Re: Two onCreate (and onDestroy) invocations on orientation chage

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 <pawel.kap...@googlemail.com> wrote:
> Hello.
>
> With following simple code (on clean, new android project):
>
> public class RotationTest extends Activity {
>
>     private static final String LOGTAG = "RotationTest";
>
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>         Log.d(LOGTAG, "onCreate():");
>     }
>
>     @Override
>     protected void onDestroy() {
>         super.onDestroy();
>         Log.d(LOGTAG, "onDestroy():");
>     }
>
> }
>
> the onCreate/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(!) ?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate