I know that you can interrupt a thread created from say a runnable class, but how can I interrupt this thread I created from a method? Using a volatile boolean isn't working for me, so I assume either there is a better way to do this, or I need to somehow interrupt it. I don't want to interrupt all threads, just this one.
I created a method that kicks off a Thread like this:
public static void StartSyncThread() {
new Thread() {
public void run() {
isRunning = true; // Set to true so while loop will start
while (isRunning) {
...
}
} // Close run()
}.start();
}
....
public static void KillSyncThread() {
isRunning = false;
}