On Sep 27, 1:31 pm, Carl Whalley <carl.whal...@googlemail.com> wrote:
> This is with the 1.6 & 1.5 SDKs, not tried earlier ones. When you
> switch from portrait to landscape the onSaveInstanceState()/
> onRestoreInstanceState() pair are called once, but when going back
> from landscape to portrait they are called twice, unless I've missed
> something.
> To test, see the log after creating a default Hello World app and
> change the main class like this:
>
> public class MainActivity extends Activity {
> private static final String TAG = "activity";
>
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(new MainView(this));
> }
>
> @Override
> protected void onRestoreInstanceState(Bundle savedInstanceState) {
> super.onRestoreInstanceState(savedInstanceState);
> Log.d(TAG, "onRestoreInstanceState()");
> }
>
> @Override
> protected void onSaveInstanceState(Bundle outState) {
> Log.d(TAG, "onSaveInstanceState()");
> super.onSaveInstanceState(outState);
> }
>
> public class MainView extends LinearLayout {
> public MainView(Context context) {
> super(context);
> inflate(context, R.layout.main, this);
> }
> }
>
> }
>
> --http://www.androidacademy.com
hi,
it's called twice because two activities are created: first one lives
for a very short time - it's immediately onDestroy()ed.
i posted about this couple of months ago but nobody seemed to answer
oskink
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---