javaandroidsamsung-mobile-sdkstylus-pen

Samsung S-Pen SDK - Selecting All User Input Strokes Programmatically


Using the official sample app :
http://developer.samsung.com/galaxy/pen
and specifically in the demo example PenSample5_6_TextRecognition..
There are two tools; brush to draw strokes and selection tool. The example lets you draw strokes on SpenSurfaceView and then lets you select whatever you want to recognize text..
After selection, SpenSurfaceView.ControlListener delegate fires the event :

public boolean onCreated(ArrayList selectedList, ArrayList arg1, ArrayList arg2, ArrayList arg3, int arg4, PointF arg5)

which sends selectedList as a list of selected strokes to the text recognition engine.

My question is : how to programmatically select all the strokes drawn on the canvas or the SpenSurfaceView without the user manually selection and without firing the event of selection to return selected strokes..
Thank you :)


Solution

  • The trick turned out to use the SpenPageDoc attached to the SpenSurfaceView to get all the drawn strokes

    ArrayList < SpenObjectBase> inputList= mSpenPageDoc.getObjectList(SpenObjectBase.TYPE_STROKE);