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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---