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
Post a Comment