【发布时间】:2012-11-27 18:50:26
【问题描述】:
我在 onCreate 方法中有这段代码:
ImageView iv01 = (ImageView)findViewById(R.id.hexagon01);
iv01.setOnTouchListener(new OnTouchListener(){
public boolean onTouch(View view, MotionEvent event) {
Intent intent = new Intent(view.getContext(), ChoiceActivity.class);
startActivity(intent);
return true;
}
});
当我触摸图像时,新活动会正确加载。我可以按返回按钮返回。但是当我再次按下后退按钮以关闭应用程序时,它会再次启动 onTouch 事件,再次加载活动。如何避免?
谢谢。
【问题讨论】: