Hello,
I did a simple program by overriding each of the lifecycle methods and everything works as I'd expect, except for onRestoreInstanceState(Bundle savedInstanceState)
.
I overrode the method as
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
Toast.makeText(getBaseContext(), "onRestoreInstanceState - Activity1 ", Toast.LENGTH_SHORT).show();
}
But it never gets called.
I overrode onSaveInstanceState(Bundle outState)
too and I can see the system calling it, but never the onRestoreInstanceState(Bundle savedInstanceState)
. When I press back button or so, I can see that the system calls onRestore()
, OnStart()
and onResume()
, and the UI (just two buttons) are displayed correctly.
How is it possible that the UI is restored without calling onRestoreInstanceState(Bundle savedInstanceState)
? I only do setContentView(R.layout.main)
is onCreate(savedInstanceState)
. So how does it restore the UI without calling either onCreate()
or onRestoreInstanceState()
?
Would really appreciate somebody shedding some light on this.
Thank you.