I'm only a basic Java programmer, trying to do something quite complex, so please forgive me. I've tried reading a textbook and some tutorials, but I can't get my head around this problem! Assuming I have 2 threads:
Thread A - the 'main' thread, contains UI Thread B - which once started goes into a while loop reading a buffer. This is a Runnable object
I'm wondering about the best way to get the while loop in B to stop (it's capturing data from a microphone) from the UI. Assuming: should I use: in thread B, or is there a better way?
If this is the best way, then should the variable be in thread A (so I'd pass a reference of object A to B in the constructor, and say or if I put it in thread B (as well as a method) and called the method from thread A, would the method run during the while loop, or after (e.g. never!) ?
What is the most efficient and elegant way to go about this? I need the thread to continue doing something else once the while loop has continued, so can't say which I think I've seen elsewhere.
Cheers! [ February 25, 2006: Message edited by: Chris Flynn ]