Text

[Issue] Sltw in Box Mode with more than 50 characters cause to error

Hello, It's occur on MyScript for Android. (ATK 1.1)

I have 2(or more) EditText fields in one page and re-init MyScript handwriting by click on them.

When I choose first field, swap to BoxMode and write more than 50 characters in the Box.
Then, select 2nd EditText, re-init MyScript for 2nd EditText and... ArrayIndexOutOfBoundsException Eror.

This is some of my code.(modify from sltw-sample)


protected void onCreate(final Bundle savedInstanceState)
{
findViewById(R.id.textField).setOnClickListener(new OnClickListener() {
  
  @Override
  public void onClick(View arg0) {
   mEditText = (CustomEditText) findViewById(R.id.textField);
   initHandwriting();
  }
 });

 findViewById(R.id.textField2).setOnClickListener(new OnClickListener() { 
   @Override
   public void onClick(View arg0) {
    mEditText = (CustomEditText) findViewById(R.id.textField2);
    initHandwriting();
   }
  });
}

private void initHandwriting(){
  mToolbarController = new ToolbarController(findViewById(R.id.sltw_toolbar));
  mToolbarController.setOnModeButtonClickedListener(this);

  mCandidateBarController = new CandidateBarController(findViewById(R.id.sltw_candidatebar));
 
  mWidget = (SingleLineTextWidget) findViewById(R.id.sltw_text_widget);
  mWidget.setOnConfigureListener(this);
  mWidget.setOnRecognitionListener(this);
  mWidget.setOnCursorHandleDragListener(this);
  mWidget.setOnInsertHandleDragListener(this);
  mWidget.setOnInsertHandleClickedListener(this);
  mWidget.setOnGestureListener(this);
  mWidget.setOnUserScrollListener(this);
  mWidget.setOnInsertionWindowListener(this);
 
  // hovering functionality is disabled by default
  mWidget.setHoverEnabled(true);

  mCursiveBehavior = new CursiveBehavior(mWidget, mEditText, mCandidateBarController);
  mBoxModeBehavior = new BoxModeBehavior(mWidget, mEditText, mCandidateBarController, this);

  configure(mToolbarController.getMode());
}

private void configure(int mode)
{
...config statements...
mWidget.configure("en_US", paths, lexicon, MyCertificate.getBytes()); <strong>//line 166 lead to error</strong>
...config statements...
}


And this is error from LogCat


03-06 11:46:32.141: E/AndroidRuntime(16896): FATAL EXCEPTION: main
03-06 11:46:32.141: E/AndroidRuntime(16896): Process: com.myscript.atk.sltw.sample, PID: 16896
03-06 11:46:32.141: E/AndroidRuntime(16896): java.lang.ArrayIndexOutOfBoundsException: length=0; index=-1
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.f.b.a.a(VOModelFactory.java:371)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.f.b.a.a(VOModelFactory.java:492)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.f.a.b.a(VOModelController.java:329)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.SingleLineTextWidget.L(SingleLineTextWidget.java:3440)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.SingleLineTextWidget.configure(SingleLineTextWidget.java:1789)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.sample.SampleActivity.configure(SampleActivity.java:166)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.sample.SampleActivity.initHandwriting(SampleActivity.java:119)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.sample.SampleActivity.access$1(SampleActivity.java:97)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.myscript.atk.sltw.sample.SampleActivity$2.onClick(SampleActivity.java:92)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at android.view.View.performClick(View.java:4633)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at android.view.View$PerformClick.run(View.java:19270)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at android.os.Handler.handleCallback(Handler.java:733)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at android.os.Handler.dispatchMessage(Handler.java:95)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at android.os.Looper.loop(Looper.java:136)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at android.app.ActivityThread.main(ActivityThread.java:5476)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at java.lang.reflect.Method.invokeNative(Native Method)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at java.lang.reflect.Method.invoke(Method.java:515)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
03-06 11:46:32.141: E/AndroidRuntime(16896):  at dalvik.system.NativeStart.main(Native Method)

1 Comment

Dear Sir,
Thanks for your bug report.
The box mode has been designed for specific form fields or password fields and does not support all the languages as mentioned in the ATK documentation:
http://doc.myscript.com/MyScriptATK_1.3/Android/sltw/fct/html/features.html
Even if there is no particular limitation for the Box Mode, the cursive mode seems to better fit the use case you mentioned, so could you please give us more details about your project and your use case?
Best regards

Login or Signup to post a comment
  • Support
  • Forums
  • Text
  • [Issue] Sltw in Box Mode with more than 50 characters cause to error