Interactive Ink

[Android] Pointer with same pointerId has a trace already pending

Good morning~

 I've encountered some fatal exception during recognition. Can you direct me how can I resolve it, problem is not occurring all the time, but sometimes, and after several successful attempts. So it works, but during the process sometimes gives this fatal exception. Should I have to change Pointer ID? I thought -1 operates all the required process by itself~

 

 Process: com.outdevour.codeproject, PID: 20145
    java.lang.IllegalStateException: pointer with same pointerId has a trace already pending
        at com.myscript.iink.NativeFunctions.pointerEvents(Native Method)
        at com.myscript.iink.Editor.pointerEvents(Editor.java:444)
        at com.outdevour.codeproject.MainPage.MainActivity.recognizeStrokes(MainActivity.java:804)



if (strokes.size() == 0)
            return;

        List<PointerEvent> pointerEvents = new ArrayList<>();
        for (Stroke stroke : strokes) {
            int i = 0;
            for (Point point : stroke.getPoints()) {
                PointerEventType action = PointerEventType.MOVE;
                if (i == 0) {
                    action = PointerEventType.DOWN;
                }
                if (i == stroke.getPoints().length - 1) {
                    action = PointerEventType.UP;
                }
                pointerEvents.add(new PointerEvent(action, point.x, point.y, NO_TIMESTAMP, NO_PRESSURE, PointerType.PEN, NO_POINTER_ID));
                i++;
            }
        }
        if (pointerEvents.size() > 0) {
            iInkEditor.pointerEvents(pointerEvents.toArray(new PointerEvent[pointerEvents.size()]), false);

 


Dear Zharas,


thank you for the update.


To our knowledge, we are not aware of any internal issue that could cause this error.


Nevertheless, if you happen to find an issue, please let us know.


Best regards,


Olivier


1 person likes this

Thank you, Im still trying to catch that exception, cause it happens very rarely.

Im filtering short (length <2) strokes earlier before even passing them to this function, thereby I believe it should not be problem. I wanted to know is there any other possibilities or features of framework that may cause such exceptions.. Thank you for your assistance, as you said it only happens when there is no penUp delivered, so I will try to focus on it. If I get some new information, will let you know ~

Dear Zharas,


currently, in your code, the particular case of strokes made of one point is not properly managed. Indeed, the PointerEventType.DOWN will not be taken into account. You should ensure both the PointerEventType.DOWN AND PointerEventType.UP are done.


Let us know if thos helps.


Best regards,


Olivier



1 person likes this

Dear Zharas,


this error is usually raised when a pointerUp event is missing.


In order we ensure this is the case, can you please activate the debug log? This will help investigate and see if this is the case, or another behavior.


Best regards,


Olivier

Forgot to mention that for every stroke (stroke.getPoints().length>=2) is guaranteed. In other words, there are always Pen Down and Pen Up in any stroke.

Login or Signup to post a comment