title: java.lang.IndexOutOfBoundsException: setSpan (2 ... 2) ends beyond length 1
body: <p>I got this exception, i am new for android so please help me.</p>
  
  <blockquote>
    <blockquote>
      <p>E/UncaughtException: java.lang.IndexOutOfBoundsException: setSpan (2 ... 2) ends beyond length 1</p>
    </blockquote>
  </blockquote>
  
  <pre><code>    holder.oldLaundriesQuantityEditText.addTextChangedListener(new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
          }
  
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
  
              if(s.toString().length()&gt;0){
                  int editedQuantity = Integer.parseInt(s.toString());
  
                  if(editedQuantity==0){
  
                      finalHolder.oldLaundriesQuantityEditText.setText("1");
  
                  }
                  if(editedQuantity&gt;oldLaundriesModelArrayList.get(position).getRemain_quantity()){
  
                      finalHolder.oldLaundriesQuantityEditText.setText(String.valueOf(
                              oldLaundriesModelArrayList.get(position).getRemain_quantity()
                      ));
  
                  }
  
                  finalHolder.oldLaundriesQuantityEditText.setSelection(count);
              }
  
          }
  
          @Override
          public void afterTextChanged(Editable s) {
  
          }
      });
  </code></pre>