2

I want to restart a thread by clicking a button but i been reading that you can't do it and that you need to make a new instance of your thread my question is what those that mean exactly or how do you do it.

The code for my thread is the following:

Thread thread = new Thread (new Runnable() {
   public void run() {
      try {       
         while (dialog.getProgress()< dialog.getMax()) {
            Thread.sleep(1000);
               progressHandler.sendEmptyMessage(0);
            }

       } catch (java.lang.InterruptedException e) {                    
    }
    dialog.dismiss();
});

and i start the thread whit thread.start

DonGru
  • 13,532
  • 8
  • 45
  • 55
Dgenoves
  • 23
  • 3

0 Answers0