iink SDK on Device


Android How to create a form with multiple text field such as mobile number, postal code & name on single editor view

I am able to create multiple configuration, although I am unable to configure my Text Document having specific configuration for each Content Block.

What should be the way forward to achieve it.

Best Answer
Hi Irshad,

Currently, it is not possible to configure the blocks of a Text Document to each have different configurations.
To achieve what you are trying to do, you can either combine multiple editors inside your UI (if you have just a few fields) or you can have a pool of editors that you can properly configure and use depending on which "field" of your form is active.
With the latter approach, you may want to modify the UI Reference Implementation to have a shared InputController and dispatch the input to the right editor. You can also have your renderers all share the same render target (a single Android view), provided that each editor is configured with the appropriate margins when used for a particular field (so that the content is rendered at the right location in your view).

Best regards,


2 people have this question

Dear Mael,

Has the code sample for this been implemented?



I am waiting since long time for sample, they said couple of days but still no update from them. Mael, I am waiting for the sample request you to please provide the same. Thanks, Swapnil

Dear Piyush, Dear Swapnil,

In the attached zip file, please find a patch you should extract over the "iink" directory.

Basically,  it will replace/update files and add few ones in the default getStarted  sample ; this project is designed to be a quick sample, we cannot  recommend it "as is" in a production application:

-When running the "GetStarted" , the main window of the application will display 3 rectangle views

-The top view is to recognize text, it is basically a text part

-The middle view is a math part

-The bottom one is a text part, similarly to the top one

-Each of these 3 views has its own editor

-When  writing a stroke, based on the position of the first point of the  stroke (e.g. in the top view), it will be added to the pointerEvents of  the corresponding editor.

-You can then give a try, writing text in the bottom and top rectangles, and math in the middle one

-The corresponding results will be logged when clicking the "Log result" button

Regarding the files:

-The CustomEditorView.java files extends the previous EditorView.java to support several editors

-The customeditor_view.xml defines a layout based on the CustomEditorView.java

-The  CustomInputController.java extends the previous InputController.java to  work with several editors ; based on the position of the ACTION_DOWN  MotionEvent, it will dispatch the stroke to the proper editor

-In the MainActvity.java:

  • The 3 writing views are created calling the createCustomViews() function line 61
  • We then create a view based on the customeditor_view line 64: "customEditorView = findViewById(R.id.customeditor_view);"
  • Line 65, our custom "setEngine" function is called
  • From lines 67 to 99, each editor is added a IEditorListener
  • Line 111 to 113, parts are created (you are free to set the type part you prefers, eg. 3 "Text" parts)
  • Each editor is then assigned with its part line 138
  • From  line 185 to 222, the "onOptionsItemSelected" function will get the  result of the export and Logs it in the logcat when the "Log result"  button is pressed
  • Last, from line 256 to 304, we define the 3 views in which we write ("createCustomViews" function)

If  playing with this easy sample, you understand how a form sample could  be defined, creating several views, each one with its own editor ; when a  stroke is drawn in a view, it is then added to the pointerEvents of the  editor corresponding to this view.

We insist this is a quick  demo sample, which may not be updated nor maintained in the future,  which may still contain bugs and shall not be used "as is" for a mass  production application ; it is your own responsibility to develop a form  application ; the purpose of this sample is just to explain one way it  may be done.

Best regards,


Hi Olivier,

The zip file is not downloadable.

It is readonly.



Dear Piyush,

please find it here.

Best regards,


Hi Olivier, 

After installing the patch, I am getting compilation error.

The following class from UIReferenceImplementation is not there.

import com.myscript.iink.uireferenceimplementation.IRenderView;



Dear Piyush,

you can just comment the corresponding lines in the CustomEditorView.java file.

private IRenderView renderView;
private IRenderView[] layerViews;

Best regards,


Dear Olivier,

I am able to compile, however I am getting a NullPointerException when the application is trying to start. The reason is that editor is coming as null. Do I have to do something else.




Dear Piyush,

just patch the EditorView.java file as follows:

-Go to the onSizeChanged function

-add the red part:

if (editor != null) {
editor.setViewSize(newWidth, newHeight);
  invalidate(renderer, EnumSet.allOf(IRenderTarget.LayerType.class));

Best regards,


Thanks Oliver and Mael for your help.

This gives me a good idea of how to implement multiple editors.