2

I'm developing an android application and i'm almost done, and in order to have a good application i wanted to know how to properly implement the onDestroy method, i mean do i have to call the garbage collector or set everything to null?

thanks in advance..

ColdFire
  • 6,764
  • 6
  • 35
  • 51

2 Answers2

2

If you have a database opened,or a opened cursor you can close them in onDestroy() method.System will automatically call gc when it is necessary.

Rasel
  • 15,499
  • 6
  • 40
  • 50
  • yeah this is the kind of thing i was looking for.. and what the acitivities' members should i do something about them like calling gc or something? – ColdFire Sep 06 '11 at 09:06
  • you can System.gc() though it is done by system automatically when it needs to free some memory – Rasel Sep 06 '11 at 09:10
1

On Destroy method you can set null all and System.gc() for garbage collector,,,,,Mind that its not neccesary to set null Because java has this feature to null object using garbage collector..........

Samir Mangroliya
  • 39,918
  • 16
  • 117
  • 134