public void changeSettingsAutoupdate(boolean autoupdate) { settings.setAutoupdate(autoupdate); if (!autoupdate) { updateAllInBackground.interrupt(); } else { startBackgroundThread(); } }
private void startBackgroundThread() { if (updateAllInBackground == null || !updateAllInBackground.isAlive()) { updateAllInBackground = new Thread("UpdateAllThread") { @Override public void run() { while (!isInterrupted()) { try { sleep(settings.getAutoupdateInterval() * 1000); updateAll(); } catch (InterruptedException ex) { return; } } } }; updateAllInBackground.start(); } }