To grab text from Edit text and highlight this text in Current text view
<p>I working on module to search grab text from edit text and search it into current text view. If present highlight this text in current text view. I also googled for this code but didn't found any relevant answer. </p>

<pre><code>tv=(TextView) mView.findViewById(R.id.detailsText);
    edit_text=(EditText)findViewById(R.id.searchText);


edit_text.addTextChangedListener(new TextWatcher() {

        @Override
        public void afterTextChanged(Editable s) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

            hightLightText(tv, s.toString());
        }
    });



}

void hightLightText(TextView textView, String searchString){
    try{

        String s=getResources().getString(R.string.firstpage);

        String withHighLightedText = s.replaceAll(searchString, "&lt;font color='red'&gt;"+searchString+"&lt;/font&gt;");
        String styledText = "This is &lt;font color='red'&gt;simple&lt;/font&gt;.";
        textView.setText(Html.fromHtml(withHighLightedText), TextView.BufferType.SPANNABLE);
        }catch(Exception ex){

        }

}
</code></pre>
