我有一个新的Intent Activity,我想在注册双击时打开它。我知道双击功能正常,但每次尝试启动新的Activity时它都会停止工作(强制退出)。
代码:
imView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
long thisTime = System.currentTimeMillis();
if (thisTime - lastTouchTime < 250) {
// Double click
//Toast toast = Toast.makeText(getApplicationContext(), "Double Tap Worked!", 10);
//toast.show();
lastTouchTime = -1;
Intent myIntent = new Intent(v.getContext(), zoom.class);
startActivityForResult(myIntent, 0);
} else {
// too slow
lastTouchTime = thisTime;
}
}
});