Hi everybody¡
I was looking in the forum how to solve my problem but wasnt able to find the answer, so here i go:
I have these clases:
*hilo <-- this is the
thread
*inter <--- this is the Form class with a button "SwitchForm", that when clicked starts the thread, and switches to form "secondForm"
*secondForm <-- another Form class with a button named "returnToInterForm"
When i press the button "SwitchForm" in the class inter, the thread "hilo" starts running, the form "inter" closes, and the form "secondForm" sets visible... this is the code in the button "SwitchForm" :
when i press the button "returnToInterForm" thats switches to "inter" again , i dont need the thread running anymore... but i dont know how to close that Thread.
I could write a code in the button "returnToInterForm" that let me close the thread...but dont know exactly how.
The way i found is this:
I Tried with a method in the Thread "hilo" like this:
and tried to activate that method using the code "hilo.closeHilo();" but have some problems, cause i cannot use that line of code if the method closeHilo is not static, and cannot make "public static void closeHilo()" cause "this.stop()" cannot be referenced in a static method.
I appreciate your help in advance¡¡