Hi Stuart,

Can you determine whether the life cycle of the thread is bound to
which? The SurfaceView or the Activity,
I think the common control should have a callback to let you know that
its life cycle is come to an end (onDestroyed or onSurfaceDestroyed),
you can try to join the Thread at that time, and make sure you have a
well control Thread( extends Thread and define some variable to control
the run()), stop it and join it will help you let the Thread end safely,
as it will have no call back to the object bind the thread when the
object is destroyed.

I cannot provide a sample code, but the concept should be:

SafeThread extends Thread {

boolean stop = false

    run() {
        while (!stop)
        ...
    }

    stop(){
        stop = true;
    }

}

and 

onDestroyed() {
    safeThread.stop();
    safeThread.join();
}

BR,
Nam

-- 
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

Reply via email to