if you want to end it manually you have the right idea.
Code:
public class Recurse extends Thread{
boolean running = false;
public Recurse(){
// constructor stuff here
this.start();
}
public void run(){
running = true;
while(running){
//your code here
}
public void halt(){
running = false;}
}
this will run the loop till the halt method is called causing the flag to be set to false. The stop() method should not be used because it stops the execution immediately and may result in data corruption and general messiness.
Bookmarks