title: EditText clearComposingText in TextWatcher (Need to remove autocorrect underline in Android OS 4.4)
body: <p>I'm trying to do something similar to this post (<a href="https://stackoverflow.com/questions/30992048/how-to-remove-android-auto-suggest-underlining-in-edittext">How to remove Android auto-suggest underlining in EditText?</a>) where I want to remove the underline while the user is typing. I am making a rich text editor and do not want the autocomplete underlines to be confused with the underlines that are part of the rich text. </p>
  
  <p>I have a RichTextEditor (which is a rich text editor that extends AppCompatEditText) and with an inner RichTextEditorTextWatcher class. I am doing <code>RichTextEditor.this.clearComposingText()</code> each time the user types, because I do not want to see the underline while the user is typing. </p>
  
  <p>Issue: When I remove the <code>MyEditText.this.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);</code> line, every time the user types, the entire word suggestion is appended as part of any input, which is totally wrong.</p>
  
  <p>e.g. when I type "A", then "d", then "e", I get "AAdAde" in the edit text.</p>
  
  <p>Putting <code>RichTextEditor.this.clearComposingText();</code> in <code>beforeTextChanged</code> doesn't work either.</p>
  
  <p>What I need is the autocomplete underline removed, with other behavior preserved (i.e. I need textMultiline etc as in my inputType attribute in the XML).</p>
  
  <p>How can I fix this?</p>
  
  <p><strong>NOTE</strong>: This problem of the autocomplete underline appearing is only occurring in OS 4.4 (Samsung Galaxy S4). The         <code>android:inputType="textNoSuggestions"</code> seems to have no effect on this version of Android, whereas it works on later versions of Android.</p>
  
  <pre><code>public class RichTextEditor extends AppCompatEditText
  {
  
  
      public class RichTextEditorTextWatcher implements TextWatcher
      {
          @Override
          public void afterTextChanged(Editable e)
          {
              //other implementation not shown here
          }
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count)
          {
               RichTextEditor.this.clearComposingText();
               RichTextEditor.this.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
          }
      }  
  </code></pre>
  
  <p>}</p>
  
  <pre><code>&lt;com.my.app.RichTextEditor android:id="@+id/rich_text_editor"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:focusable="true"
      android:focusableInTouchMode="true"
      android:gravity="top"
      android:imeOptions="flagNoExtractUi"
      android:inputType="textMultiLine|textCapSentences|textLongMessage|textNoSuggestions"
      android:isScrollContainer="true"
      android:minHeight="100dp"
      android:scrollbarAlwaysDrawVerticalTrack="true"
      android:scrollbars="vertical" /&gt;
  </code></pre>
  
  <p>I have tried the suggestions here: <a href="http://charlesharley.com/2011/programming/disabling-android-textview-suggestions" rel="nofollow noreferrer">http://charlesharley.com/2011/programming/disabling-android-textview-suggestions</a> but they don't work on Samsung Galaxy S4. i.e., the following do not work:</p>
  
  <p><code>&lt;TextView android:inputType="textVisiblePassword" /&gt;</code>
  <code>&lt;TextView android:inputType="textFilter" /&gt;</code></p>