public void surfaceCreated(SurfaceHolder holder) { if (m_graphThread.getState() == Thread.State.TERMINATED) { m_graphThread = new SpectrumThread(getHolder(), this); m_graphThread.setRunning(true); m_graphThread.start(); } else { m_graphThread.setRunning(true); m_graphThread.start(); } Log.v(TAG, "Created surface"); }
public void surfaceDestroyed(SurfaceHolder holder) { boolean retry = true; m_graphThread.setRunning(false); while (retry) { try { m_graphThread.join(); retry = false; } catch (InterruptedException e) { // Try again... } } }