On Jul 20, 4:06 am, Warren <[email protected]> wrote: > I am having trouble with the order of function callbacks in a game. I > create and start a game thread in the onCreate() of my activity. In > the onPause() of the activity, I pause the thread. And in > surfaceDestroyed() I stop the thread entirely. I have tried several > other configurations, but I always run into one of two scenarios: I > either try to start a thread that already exists, or my activity > resumes without restarting the game thread.
I stop my game thread in onPause() and then start a new one in onResume (). I think that's the way it's done in the API samples as well. I found managing the activity lifecycle quite delicate and it took me a long time to get right. If you're using OpenGL you might like to have at look at GLSurfaceView, because it looks like it simplifies things significantly: http://android-developers.blogspot.com/2009/04/introducing-glsurfaceview.html -- Jon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

