public synchronized void stop() { // Stops the Thread running = false; try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); // Catches any errors if the Thread crashes } }