I've been programming a simple physics engine in android for practice. I am using multiple threads to handle the graphics (1 thread inside a custom surfaceview) a physics thread that runs inside a Game class (not in the UI thread). Every time I close the application I get the error message claiming that the app has stopped working, but when I examine the LogCat in Eclipse, it only tells me that the app has died and that no errors have actually occurred. Sometimes when the app is running I get the same problem but again the LogCat only shows that the application has died and not that there were any errors causing it to force close. I then looked at the CPU usage in eclipse, and it shows that the application begins to reach 90%+ of the CPU. I am worried that Android is killing my application because it is taking up too many system resources.
My questions are:
How do I manage the threads so that they don't go crazy and consume incredible system resources?
(I am already limiting the physics and graphics threads to 30 updates per second. But I am only extending the basic java Thread class, not using Handlers or Timers, which I've heard mention of)