title: SpannableStringBuilder: indexOutOfBoundsException setSpan ends beyond length 0
body: <p>I am working in android. i have a problem. my application crashes when i click on my text box second time.</p>
  
  <p>this is my Logcat message:</p>
  
  <pre><code>java.lang.IndexOutOfBoundsException: setSpan (4 ... 4) ends beyond length 0
  android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:943)
  android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:522)
  android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:514)
  android.text.Selection.setSelection(Selection.java:74)
  android.text.Selection.setSelection(Selection.java:85)
  android.text.method.ArrowKeyMovementMethod.onTouchEvent(ArrowKeyMovementMethod.java:410)
  android.widget.TextView.onTouchEvent(TextView.java:6715)
  android.widget.EditText.onTouchEvent(EditText.java:190)
  android.view.View.dispatchTouchEvent(View.java:3766)
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
  android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
  com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1731)
  com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1120)
  android.app.Activity.dispatchTouchEvent(Activity.java:2086)
  com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1715)
  android.view.ViewRoot.handleMessage(ViewRoot.java:1787)
  android.os.Handler.dispatchMessage(Handler.java:99)
  </code></pre>
  
  <p>please help me to find out the cause of this problem.
  Thank you in advance.</p>