(我有 MainActivity 类(扩展 Activity),我有方法 setContentView(GameView);GameView 是一个扩展 View 的类,在这个类(GameView)中我有方法:
boolean inTouchEvent(MotionEvent event){
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
//here I would like to go to another activity to class MainMenuActivity()
}
}
提前致谢。
好的,它的工作:
public boolean onTouchEvent(MotionEvent event){
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
Intent intent = new Intent (contexTmp, MainActivity.class);
contexTmp.startActivity(intent);
((Activity)getContext()).finish();
}
}