Android: Call super() at the beginning or end of onStart(), onStop(), onDestroy() in activity?

mrd picture mrd · Aug 12, 2012 · Viewed 11.7k times · Source

Where in onStart(), onStop(), onDestroy() of an activity do I call super.onStart(), super.onStop(), super.onDestroy() ?

Answer

iTurki picture iTurki · Aug 12, 2012

That's my way of calling these super methods:

  • OnCreate(): Definitely the first thing.
  • OnDestroy(): The last thing.
  • OnStop(): The last thing.

However, for the last two, no matter where you call them (in most most cases). So some people prefer to put them at the first to be consistent.