1
我有一个是通过所有MotionEvents在我的意见的onTouchEvent()方法简单的手势检测器,每本教程:的Android调试在私人子类/手势测井探测器
http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html
的样品我代码,吸引周围的手指了一圈,当触摸屏:
@Override
public boolean onTouchEvent(MotionEvent ev) {
// send the touch event to the gesture detector
if (mBuildupDetector.onTouchEvent(ev)) {
Log.d(LOG_TAG, "onTouchEvent(): Gesture consumed.");
} else {
Log.d(LOG_TAG, "onTouchEvent(): Gesture not consumed.");
}
switch (curAction) {
case MotionEvent.ACTION_DOWN: {
drawCircle();
}
}
}
然后一个私有子类姿态探测器:
private class BuildupListener extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onDown(MotionEvent ev) {
Log.d("BuildupListener", "onDown(): Triggered.");
return true;
}
}
所以,当用户触摸屏幕时,产生一个运动事件,我得到一个手势确实被“消耗”的配置,并且我可以在GestureDectector的onDown方法中改变圆的直径。但是,即使它看起来被调用并执行,也不会从onDown中写出日志。
我是否缺少关于日志记录的基本知识以及如何从私有子类或手势检测器内部发生日志记录?
感谢,
保罗