I have a surfaceView setup and running, but when i resume it i get an error that the thread has already been started. Whats the proper way to handle when the app goes to the background and then back to the foreground? Ive tinkered around and managed to get the app to come back without crashing...but the surfaceView doesnt draw anthing anymore. My code:
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.e("sys","surfaceCreated was called.");
if(systemState==BACKGROUND){
thread.setRunning(true);
}
else {
thread.setRunning(true);
thread.start();
Log.e("sys","started thread");
systemState=READY;
}
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.e("sys","surfaceDestroyed was called.");
thread.setRunning(false);
systemState=BACKGROUND;
}