title: Format words in android EditText view on textchange
body: <p>I am working with android 2.2.
  I want to format multiple words as per my adapter contains.
  like</p>
  
  <pre><code>final ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
                  android.R.layout.simple_list_item_1);
          adapter.add("aaaa");
          adapter.add("abaa");
          adapter.add("acaa");
          adapter.add("adaa");
          adapter.add("aaba");
          adapter.add("aaca");
          adapter.add("aaba");
          adapter.add("aaae");
  </code></pre>
  
  <p>I have one EditText-view in which i am I writing text but if on text change i found any word which is matching with adapters value that i want to highlight.</p>
  
  <p>Please refer the following code on text change but not getting perfect output.</p>
  
  <pre><code>@Override
              public void afterTextChanged(Editable s) {
                  CharSequence cs;
                  // TODO Auto-generated method stub
  
                  str = myAutoComplete.getText().toString();
              for(int i = 0; i &lt; adapter.getCount(); i++)
              {   
                  String s2 = adapter.getItem(i).toString().toLowerCase();    
  
                  if (str.contains(s2) == true) 
                  {   Log.e("s2",s2);                     
                      str =  str.replaceAll(s2, "&lt;font color='red'&gt;"+s2+"&lt;/font&gt;");
                      Log.e("str",str);
                      myAutoComplete.setText(Html.fromHtml(str), TextView.BufferType.SPANNABLE);
                  }
  
              }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/VVhTP.png" alt="enter image description here"></p>