multithreading - Android SurfaceView Thread with multiple activities -


i have thread part of surface view object:

public class gamearena extends surfaceview implements surfaceholder.callback {       private gamethread thread = null;       // etc } 

and surface view part of activity.

later when user clicks screen, new activity launched, own different surface view.

the problem have finding how/when cancel thread when user press' home button in second activity, when start app again thread exists.

many thanks

you should not have thread created within surfaceview, instead should create thread within activity owns surfaceview. in addition, synchronization needed between thread , activity thread life cycle.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -