I need to act differently in onStart()
method depending on how onCreate()
was called in result
of orientation change
or not. Is that
Just check the bundle: when the activity is first started the bundle will be null. If there is an orientation change, it should be non-null.
From the android docs:
If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in onSaveInstanceState(Bundle). Note: Otherwise it is null.
Edit: I don't think you have to supply a bundle in onSaveInstanceState for it to be non-null after an orientation change, but that would be trivial.
In that case, why don't you handle configuration chanages (orientation) by yourself. Tell android not to handle screen orientation.
android:configChanges="keyboardHidden|orientation"
Then you just override onConfigurationChanged method to get your rearranging of view or whatsoever things need to be done. Leave things that you don't wanna get executed.
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
//do your jobs
}