@Override public void onResume() { // kick off the data generating thread: myThread = new Thread(data); myThread.start(); super.onResume(); }
// @Override public void run() { try { keepRunning = true; boolean isRising = true; while (keepRunning) { Thread.sleep(10); // decrease or remove to speed up the refresh rate. phase++; if (sinAmp >= MAX_AMP_SEED) { isRising = false; } else if (sinAmp <= MIN_AMP_SEED) { isRising = true; } if (isRising) { sinAmp += AMP_STEP; } else { sinAmp -= AMP_STEP; } notifier.notifyObservers(); } } catch (InterruptedException e) { e.printStackTrace(); } }