Question

I have a simple Gesture Detector that is passed all MotionEvents in my Views onTouchEvent() method, per this tutorial:

http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html

A sample of my code, which draws a circle around the finger when it touches the screen:

@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();
            }
    }
}

And then a private sub-class for the gesture detector:

private class BuildupListener extends GestureDetector.SimpleOnGestureListener {
    @Override
    public boolean onDown(MotionEvent ev) {
        Log.d("BuildupListener", "onDown(): Triggered.");
        return true;
    }
}

So, when the user touches the screen, generating a motion event, I am getting a confimation that the gesture was indeed 'consumed', and I can change the diameter of the circle in the onDown method of the GestureDectector. However, no logging is written out from onDown, even though it appears to be called and executed.

Am I missing something basic about logging and how logging can happen from inside private sub-classes, or gesture detectors?

Thanks,

Paul

Was it helpful?

Solution

Found the issue, it was an error with LogCat I believe. Dropping the LogCat tab from Eclipse and re-enabling it resulted in all the logging being shown as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top