0

I have an android app, ATV Trail Locator (http://www.youtube.com/watch?v=Wmk3cA2i2vI), that uses google maps.

Because my server is used for web serving and the Android app, I want to be able to kill the app in case it takes up too many server resources by setting a variable in my mysql database.

Because the application communicates with The server every second, it can get this variable and then shutdown the program if it is equal to 0.

I tried to call onDestroy() directly, but my program crashed. Do I need to use super.onDestroy() in order to kill the program without requiring back button push?

Thanks,

animuson
  • 53,861
  • 28
  • 137
  • 147
Marc Brown
  • 601
  • 2
  • 11
  • 26

2 Answers2

2

Have you tried calling finish() instead?

If this doesn't work, please post a code sample and your logcat errors so we can see what is happening.

Sam
  • 86,580
  • 20
  • 181
  • 179
2

Call finish() whenever you want to kill the current activity you're on. It'll call onDestroy() along with all the other required Activity lifecycle methods that need to be called.

DeeV
  • 35,865
  • 9
  • 108
  • 95