I have this code on my MainActivity:
@Override
public boolean onTouchEvent(MotionEvent event) {
float x = (float)(event.getX());
float y = (float)(event.getY());
if(y>=screenh/3&&y<(screenh/4)*2)
setContentView(g);
g is a surfaceview. When I click on this specific place on the screen I want to set the contentview to the surfaceview, but it gives me "thread already started" exception at:
@Override
public void surfaceCreated(SurfaceHolder holder) {
gameLoopThread.setRunning(true);
gameLoopThread.start();
}
if I set the contentview at onCreate to g, there is no error. Why?
Aucun commentaire:
Enregistrer un commentaire