Skip to content Skip to sidebar Skip to footer

Automatically Exit Surfaceview

I have a game I'm developing for Android 2.x. When the player looses, I want to automatically exit that and go back to the previous menu of the game. This may be a simple question,

Solution 1:

In my thread, I call the following method from my surfaceview's doTouch:

public void doLose() {
            synchronized (mSurfaceHolder) {
                //quit to mainmenu
                ((Activity) mContext).finish();
            }            
        }

This seems to shut down the surfaceview and the activity hosting it, dumping me back in my main-menu activity. Note the casting and the predefined context.

Solution 2:

Post a Comment for "Automatically Exit Surfaceview"