【问题标题】:Android Debug Logging in Private Sub-Class/Gesture Detector私有子类/手势检测器中的 Android 调试日志记录
【发布时间】: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


    【解决方案1】:

    发现了问题,我相信这是 LogCat 的错误。从 Eclipse 中删除 LogCat 选项卡并重新启用它会导致所有日志记录按预期显示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-02
      • 2017-07-26
      • 1970-01-01
      • 2013-01-27
      相关资源
      最近更新 更多