14.06.2011

surfaceChanged() and surfaceDestroyed()

posted by Karsten

//Always called once after surfaceCreated. Tell the GameThread the actual size public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if(thread!=null) { thread.setSurfaceSize(width, height); } } /* * Need to stop the GameThread if the surface is destroyed * Remember this doesn't need to happen when app is paused on even stopped. */ public void surfaceDestroyed(SurfaceHolder arg0) { boolean retry = true; if(thread!=null) { thread.setRunning(false); } //join the thread with this thread while (retry) { try { if(thread!=null) { thread.join(); } retry = false; } catch (InterruptedException e) { //naugthy, ought to do something... } } }

Share

Place your comment

Please fill your data and comment below.
Name
Email
Website
Your comment