Android OnTouchEvent: Debugging InputEventConsistencyVerifier messages

I have a layout configured with gesture listener for OnTouchEvent() . The layout contains a listview and I am using gestures to capture row id of the listview. I have the following code -

 itemsList.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View arg0, MotionEvent evt) {
            // TODO Auto-generated method stub
            //
            int action = evt.getAction();
            final String DEBUG_TAG = "DEBUG";
            detector.onTouchEvent(evt);
            switch(action) {
                case (MotionEvent.ACTION_DOWN) :
                    Log.d(DEBUG_TAG,"Action was DOWN");
                    return true;
                case (MotionEvent.ACTION_MOVE) :
                    Log.d(DEBUG_TAG,"Action was MOVE");
                    return true;
                case (MotionEvent.ACTION_UP) :
                    Log.d(DEBUG_TAG,"Action was UP");
                    return true;
                case (MotionEvent.ACTION_CANCEL) :
                    Log.d(DEBUG_TAG,"Action was CANCEL");
                    return true;
                case (MotionEvent.ACTION_OUTSIDE) :
                    Log.d(DEBUG_TAG,"Movement occurred outside bounds " +
                            "of current screen element");
                    return true;    
            } 

            return false;
        }

    });

detector is the GestureDetector instance. I am basically using just swipe left or swipe right actions on a row of the listview.

Whenever I swipe left / right I receive 3 debug messages in Logcat (Information or something to look at??).

D/InputEventConsistencyVerifier(24700): TouchEvent: ACTION_MOVE contained 1 pointers 
but there are currently 0 pointers down.

D/InputEventConsistencyVerifier(24700):   in android.view.GestureDetector@b50cf9b0

D/InputEventConsistencyVerifier(23596):   0: sent at 37751425150760, 
MotionEvent { action=ACTION_MOVE, id[0]=0, x[0]=39.00721, y[0]=28.526703, toolType[0]=TOOL_TYPE_FINGER, 
buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=37751425, 
downTime=37751133, deviceId=0, source=0x1002 }

There are also 4 debug messages from the OnTouchListener -

Action was ACTION MOVE
Action was ACTION MOVE
Action was ACTION MOVE
Action was ACTION UP

Which corresponds to the swipe movement I believe.

The main activity class extends OnGestureListener hence has its unimplemented methods such as onFling.. etc etc.

The problem is that the onFling method is called only after ACTION UP event and when that occurs the argument passed to the method mevt1 is null while mevt2 is not null. (Default behaviour?)

onFling(MotionEvent mevt1, MotionEvent mevt2, float velX, float velY)

The method uses mevt1 and hence this causes nullpointexception.

I want to know if the debug messages from InputEventConsistencyVerifier is of any concern and if anyone knows if this is any problem at all?


you have to call

detector.onTouchEvent(evt)

for every action, not just ACTION_MOVE

链接地址: http://www.djcxy.com/p/91230.html

上一篇: GestureDetector Multi

下一篇: Android OnTouchEvent:调试InputEventConsistencyVerifier消息