我正在尝试使用此代码设置“ontouchlistener”。它说代码中没有错误,但是当我尝试运行它时,我会强制退出……出了什么问题?有任何想法吗?
final Handler handler = new Handler();
Runnable mLongPressed = new Runnable() {
public void run() {
}
};
@Override
public boolean onTouchEvent(MotionEvent event, View v){
if(event.getAction() == MotionEvent.ACTION_DOWN)
handler.postDelayed(mLongPressed, 1000);
if((event.getAction() == MotionEvent.ACTION_MOVE)||(event.getAction() ==
MotionEvent.ACTION_UP))
handler.removeCallbacks(mLongPressed);
return false;
}