JAVA:
public class GameView extends SurfaceView implements SurfaceHolder.Callback, View.OnTouchListener, Runnable{ private GameActivity gameActivity; private SurfaceHolder holder; //-- 构造、初始化 -- public GameView(Context context) { super(gameActivity); getHolder().addCallback(this); this.setOnTouchListener(this); this.gameActivity =( GameActivity ) context;//重点就是这步,强转。 init(); initDraw(); } //----------------- // 省略部分^&……%…… //----------------- public void goActivity() { runState = false; gameActivity.goGameoverActivity(); } }