问题
Why is it that you need to call the super class in the android lifecycle? For example, in onCreate you need to call super.onCreate, or onDestroy super.onDestroy.
回答1:
It makes sure that any relevant lifecycle management code across the full class hierarchy gets invoked.
If you have MyBaseActivity
that extends Activity
, and MySpecificActivity
that extends MyBaseActivity
, calling through to the lifecycle methods in the superclass at each level means MyBaseActivity
will still be able to respond to lifecycle events.
来源:https://stackoverflow.com/questions/5395672/super-class-android-life-cycle