Diagram

Answered

handwriting recognition anr problem

inkEditor.waitForIdle();
In the pattern recognition mode, calling this method will cause anr problem.
We input a piece of handwriting, that is, the handwriting of the down and up sections, and then check the timer every 50ms to read the recognition result. Then keep writing and keep writing, and there will be a blocking problem of inkEditor.waitForIdle().

Best Answer

Dear 刚 陈,

thank you for the updates.

Indeed, your code confirms you are using the incremental API, which is the way to add strokes as soon as they are written.

In that case you must not use the waitForIdle, as it will block the thread until the recognition result is available. And as recognition is a demanding process and depends hugely on the hardware (CPU,cache memory...), it can take time to get a result.

As said above, the approach is to proceed as we do in our smartGuideView.java class: when a contentChanged happens, you simply export as JIIX/Text, and you can then get the result. Any other approach is not likely to work properly.

Best regards,

Olivier


Dear 刚 陈,,


Thank you for your question.


With the description you are giving, it is not suprising calling the "waitForIdle" every 50 ms is causing an ANR.


I guess you are using the incremental API to get strokes? Am I right? If using the "series of events", please let us know.


Indeed, the waitForIdle will wait the editor is in "idle state", so that you can have a result.


If using the incremental mode and want to have the result frequently, the easier is that you refer to the SmartGuideView.java class we provide.


Indeed, we proceed as follows: When we have a "change" the "update" function is called ; in the latter, we export as JIIX.


You shall then be able to trigger a recognition result, withhout using the "waitForIdle".


Best regards,


Olivier

We use this set of apis,pointerDown,pointerMove,


image


 

image


After I checked the log repeatedly, I found that after we completed the handwriting input, there was no problem with the events. Then it is determined that it is idle, and it is stuck in the step of waiting for idle.

Our approach is to read the result directly after completing the input

image


Answer

Dear 刚 陈,

thank you for the updates.

Indeed, your code confirms you are using the incremental API, which is the way to add strokes as soon as they are written.

In that case you must not use the waitForIdle, as it will block the thread until the recognition result is available. And as recognition is a demanding process and depends hugely on the hardware (CPU,cache memory...), it can take time to get a result.

As said above, the approach is to proceed as we do in our smartGuideView.java class: when a contentChanged happens, you simply export as JIIX/Text, and you can then get the result. Any other approach is not likely to work properly.

Best regards,

Olivier