Re: [android-beginners] Re: onDestroy() caused application stopped unexpectedly

2010-01-08 Thread TreKing

 It does stop retrieving GPS signals after I exit the app.


If this is why you're doing this, you're going about this the wrong way. Use
finish() on your activity, not System.exit(), and if you have a location
listener set up that is using the GPS make sure to unregister it in your
onPause() / onStop() / onDestroy() methods, depending on what functionality
you need.

-
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking


On Fri, Jan 8, 2010 at 1:50 AM, Justin Anderson janderson@gmail.comwrote:

 Any particular reason you are using System.exit() as opposed to finish()???

 finish() gives Android the opportunity to do any cleanup that it needs to
 when your app gets done... I would imaging that System.exit() bypasses this.


 --
 There are only 10 types of people in the world...
 Those who know binary and those who don't.
 --


 On Thu, Jan 7, 2010 at 11:27 PM, ZhouSu zsmarga...@gmail.com wrote:

 Thanks Justin and TreKing!
 I haven't found the error for onDestroy after looking at the log
 but I've managed to close the application using JAVA System.exit()
 instead.
 It does stop retrieving GPS signals after I exit the app.



 On Jan 7, 2:20 am, TreKing treking...@gmail.com wrote:
   BTW, if i change onDestroy() to finish(), the application works fine
 so
   other parts should have no problem. How can I end the application
 lifecycle
   successfully?
 
  Um ... call finish() instead of onDestroy?
 
  Look at the logs like Justin said. My guess: you're not supposed to call
  onDestroy() and the system is throwing an exception because you've done
 so
  (I believe I've seen it also throw if you don't call super.onDestroy()
 in
  your overwritten method ... so *it knows* .
 
 
 ---
 --
  TreKing - Chicago transit tracking app for Android-powered
 deviceshttp://sites.google.com/site/rezmobileapps/treking

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en



 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: onDestroy() caused application stopped unexpectedly

2010-01-07 Thread Justin Anderson
Any particular reason you are using System.exit() as opposed to finish()???

finish() gives Android the opportunity to do any cleanup that it needs to
when your app gets done... I would imaging that System.exit() bypasses this.

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Thu, Jan 7, 2010 at 11:27 PM, ZhouSu zsmarga...@gmail.com wrote:

 Thanks Justin and TreKing!
 I haven't found the error for onDestroy after looking at the log
 but I've managed to close the application using JAVA System.exit()
 instead.
 It does stop retrieving GPS signals after I exit the app.



 On Jan 7, 2:20 am, TreKing treking...@gmail.com wrote:
   BTW, if i change onDestroy() to finish(), the application works fine so
   other parts should have no problem. How can I end the application
 lifecycle
   successfully?
 
  Um ... call finish() instead of onDestroy?
 
  Look at the logs like Justin said. My guess: you're not supposed to call
  onDestroy() and the system is throwing an exception because you've done
 so
  (I believe I've seen it also throw if you don't call super.onDestroy() in
  your overwritten method ... so *it knows* .
 
 
 ---
 --
  TreKing - Chicago transit tracking app for Android-powered deviceshttp://
 sites.google.com/site/rezmobileapps/treking

 --
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en