void setHighLightedText(final TextView tv, final String textToHighlight) {
        final String text = tv.getText().toString().toLowerCase();
        int ofe = text.indexOf(textToHighlight, 0);
        final Spannable wordToSpan = new SpannableString(tv.getText());
        for (int ofs = 0; ofs < text.length() && ofe != -1; ofs = ofe + 1) {
            ofe = text.indexOf(textToHighlight, ofs);
            if (ofe == -1) {
                break;
            } else {
                wordToSpan.setSpan(new ForegroundColorSpan(context.getResources().getColor(R.color.colorAccent)), ofe, ofe + textToHighlight.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                tv.setText(wordToSpan, TextView.BufferType.SPANNABLE);
            }
        }
    }
Highlight the selected text (case insensitive) in the given TextView
main/src/main/java/cgeo/geocaching/search/SearchAutoCompleteAdapter.java