【发布时间】:2010-12-29 09:46:15
【问题描述】:
根据本教程,我有一个简单的手势检测器,它在我的 Views onTouchEvent() 方法中传递所有 MotionEvents:
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,也不会写出任何日志记录。
我是否遗漏了一些关于日志记录的基本知识以及如何从私有子类或手势检测器内部进行日志记录?
谢谢,
保罗
【问题讨论】:
标签: android logging multi-touch gesturedetector