Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excessive logs from ViewDragHelper from Android drawer

I am disableing the Android navigation drawer when my user performs certain actions involving dragging objects. This is to keep them from accidentally opening the drawer. The problem is I am getting flooded with log messages. This is making it difficult to trouble shoot other issues.

This is how I lock the drawer.

drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

This is the log messages I am getting.

E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
E/ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
like image 745
theJosh Avatar asked Nov 19 '16 00:11

theJosh


Video Answer


1 Answers

I had the same problem and I solved it using requestDisallowInterceptTouchEvent function like this:

public void blockMainMenu(){
    ((DrawerLayout) findViewById(R.id.drawer_layout)).requestDisallowInterceptTouchEvent(true);
    ((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
}
public void unblockMainMenu(){
    ((DrawerLayout) findViewById(R.id.drawer_layout)).requestDisallowInterceptTouchEvent(false);
    ((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}

So, when I block my DrawerLayout, I disallow touch events, and Log not shows a lot of error messages saying that they are a lot of events lost.

Hope this can help you!

like image 158
AliMola Avatar answered Sep 30 '22 10:09

AliMola