I'm trying to get a list of all Android lifecycle methods that require calling the superclass method. There was a good list started in another thread. I'm not asking because of an error in my code, but because I want a tool to detect this specific problem.
To find the list, I searched the API 18 docs for the following strings:
- Derived classes must call through to the super class's
- if you override this method
- superclass
- SuperNotCalledException from platform sources
I ended up with the following list. I removed derived classes that have the same message as the parent.
- Application (MockApplicaition)
- onCreate()
- Activity/ActivityGroup (Fragment/DialogFragment, ListActivity, TabActivity, LauncherActivity, NativeActivity, et. al)
- onCreate(android.os.Bundle)
- onDestroy()
- onPause()
- onPostCreate(android.os.Bundle)
- onPostResume()
- onRestart()
- onResume()
- onStart()
- onStop()
- onConfigurationChanged(Configuration newConfig)
- onSaveInstanceState(android.os.Bundle) - Depends
- onRestoreInstanceState(android.os.Bundle) - Depends
- onActionModeStarted(android.view.ActionMode) - Recommended
- onActionModeFinished(android.view.ActionMode) - Recommended
- onPrepareDialog(int, android.app.Dialog, android.os.Bundle) - Recommended
- Fragment
- onAttach(FragmentActivity)
- onDetach()
- onViewStateRestored(android.os.Bundle)
- onActivityCreated(Bundle)
- onDestroyView()
- Dialog (AlertDialog, DatePickerDialog, ProgressDialog, Presentation, et. al)
- onActionModeStarted(android.view.ActionMode) - Recommended
- onActionModeFinished(android.view.ActionMode) - Recommended
- ViewPager
- onPageScrolled(int, float, int)
- drawableStateChanged()
- View/ViewGroup (ListView, TextView, KeyboardView, et. al.)
- onAnimationStart()
- onAnimationEnd()
- onMeasure(int, int) - Required to call setMeasuredDimension(int, int)
- draw(android.graphics.Canvas)
- Preference/PreferenceGroup (CheckBoxPreference, et. al.)
- onBindView(android.view.View)
- onCreateView(android.view.ViewGroup)
- onPrepareForRemoval()
onCommonsWare()
Is this the definitive list?
EDIT Based on feedback from @CommonsWare, added methods that trigger SuperNotCalledException