I Have a listview
with arrayadapter
.. i need to implement this in my music application ... help me out
Here is the Utility code that I use to highlight search key in search results,Hope this may help you to implement some part of your application
public void setTextAndhighLightSearchKeytest(String searchKey,String searchResult, TextView textView) {
if (!TextUtils.isEmpty(searchKey) && !TextUtils.isEmpty(searchResult)) {
String searchResultLowerCase = searchResult.toLowerCase(Locale.UK);
String searchKeyLowerCase = searchKey.toLowerCase(Locale.UK);
int start = searchResultLowerCase.indexOf(searchKeyLowerCase);
int end = start + searchKey.length();
if (start > -1 && start < searchResult.length() && end < searchResult.length()) {
SpannableStringBuilder builder = new SpannableStringBuilder(searchResult);
builder.setSpan(new StyleSpan(Typeface.BOLD), start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
textView.setText(builder, BufferType.SPANNABLE);
}
}
}