【发布时间】:2012-07-25 01:18:02
【问题描述】:
(我有 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();
}
}
【问题讨论】:
-
严重吗?你甚至知道文档存在吗?为什么要用这个问题来堵住 SO... 一次谷歌搜索可以告诉你 100 次以上。请在此处访问文档:developer.android.com/develop/index.html
标签: android events view android-activity touch