【发布时间】:2017-03-22 04:01:54
【问题描述】:
我有一个 Activity GamePanel,它使用下面的上下文代码扩展 Surfaceview。
public GamePanel(Context context)
{
super(context);
this.mContext = context;
mContext = getContext();
//add the callback to the surfaceholder to intercept events
getHolder().addCallback(this);
thread = new MainThread(getHolder(), this);
//make gamePanel focusable so it can handle events
setFocusable(true);
}
现在我用它从 GamePanel 转到我的 MainMenu 类。
Intent intent = new Intent(mContext, MainMenu.class);
mContext.startActivity(intent);
这是我的问题:当我按下按钮时,如何从 MainMenu Activity 返回到扩展 Surfaceview 的 Gamepanel Activity?
编辑:这是我的 GamePanel Activity 的第一行:
public class GamePanel extends SurfaceView implements SurfaceHolder.Callback
【问题讨论】:
-
Activity不能扩展SurfaceView。你做错了什么。显示类的顶行,您可以在其中看到public class GamePanel extends...,以便我们了解您的 GamePanel 到底是什么 -
这是第一行代码
标签: java android android-activity surfaceview