0

I have an Android Application that has four activities. None is very large and I have no threads or services.
Should I still implement the lifecycle methods, like onStart(), onResume(), onPause() etc?

I tried to insert some at a suitable place, but it seems a bit unnecessary. I understand they are there to provide stability to the application, but it seems more useful when one is using many threads etc. Am I mistaken?

secretformula
  • 6,414
  • 3
  • 33
  • 56
kakka47
  • 3,479
  • 8
  • 44
  • 52

2 Answers2

2

They help with stability by cleaning up resources acquired in other lifecycle methods.

You may also want to refresh data in your onResume() or save state in onDestroy() so that you can pick up where you left off when your Activity restarts.

If you don't need these features, then you don't need to implement methods other than onCreate().

Matthew
  • 44,826
  • 10
  • 98
  • 87
  • Thanks! So if I want to deal with incoming phone calls then the onDestroy() is the one that keep the state when the call is finished? – kakka47 Mar 09 '11 at 16:53
1

They are not for stability, but for flexibility. If you as a developer need to specify some behaviour in the moments of activity life you are provided with methods you can override.

So, in your case, it is not necessary to override them.

Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103