@Override
            protected FilterResults performFiltering(final CharSequence constraint) {
                final FilterResults filterResults = new FilterResults();
                if (constraint == null) {
                    return filterResults;
                }
                String[] newResults = new String[0];
                final String trimmed = StringUtils.trimToEmpty(constraint.toString());
                if (null != suggestionFunction && adapter.queryTriggersSearch(trimmed)) {
                    newResults = suggestionFunction.call(trimmed);
                    adapter.isShowingResultsFromHistory = false;
                }
                if (newResults.length == 0 && null != historyFunction) {
                    newResults = Arrays.stream(historyFunction.call()).filter(s -> s.contains(trimmed)).toArray(String[]::new);
                    adapter.isShowingResultsFromHistory = true;
                }
                filterResults.values = newResults;
                filterResults.count = newResults.length;
                return filterResults;
            }
Highlight the selected text (case insensitive) in the given TextView
main/src/main/java/cgeo/geocaching/search/SearchAutoCompleteAdapter.java