title: java.lang.IllegalArgumentException due to Spannable TextView
body: <p>I received this crash report in my Google Play Console which I myself never experience and unable to reproduce.</p>
  
  <pre><code>java.lang.IllegalArgumentException: 
    at android.text.method.WordIterator.checkOffsetIsValid (WordIterator.java:380)
    at android.text.method.WordIterator.isBoundary (WordIterator.java:101)
    at android.widget.Editor$SelectionStartHandleView.positionAtCursorOffset (Editor.java:4300)
    at android.widget.Editor$HandleView.updatePosition (Editor.java:3736)
    at android.widget.Editor$PositionListener.onPreDraw (Editor.java:2513)
    at android.view.ViewTreeObserver.dispatchOnPreDraw (ViewTreeObserver.java:944)
    at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2417)
    at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1321)
    at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6708)
    at android.view.Choreographer$CallbackRecord.run (Choreographer.java:894)
    at android.view.Choreographer.doCallbacks (Choreographer.java:696)
    at android.view.Choreographer.doFrame (Choreographer.java:631)
    at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:880)
    at android.os.Handler.handleCallback (Handler.java:815)
    at android.os.Handler.dispatchMessage (Handler.java:104)
    at android.os.Looper.loop (Looper.java:207)
    at android.app.ActivityThread.main (ActivityThread.java:5728)
    at java.lang.reflect.Method.invoke (Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)
  </code></pre>
  
  <p>The crash report didn't mention which class is causing the crash. My best guess is the follow custom <code>TextView</code>.</p>
  
  <pre><code>private void customTextView(TextView view) {
          SpannableStringBuilder spanTxt = new SpannableStringBuilder(
                  Html.fromHtml(definition[0]));
          spanTxt.append("\n\nExample");
          spanTxt.setSpan(new ClickableSpan() {
              @Override
              public void onClick(View view) {
                  showAlert();
              }
          }, spanTxt.length() -"Example".length(), spanTxt.length(), 0);
          view.setMovementMethod(LinkMovementMethod.getInstance());
          view.setText(spanTxt, TextView.BufferType.SPANNABLE);
      }
  </code></pre>
  
  <p>Is there any problem with my custom <code>TextView</code>?</p>