Skip to content

Instantly share code, notes, and snippets.

Forked from pratamawijaya/
Created September 21, 2017 08:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pishguy/d0cc4fcf80488057f5be88ad6088f61e to your computer and use it in GitHub Desktop.
// digunakan untuk Highlight text yang sedang dicari
private void setColor(TextView view, String fulltext, String subtext, int color) {
view.setText(fulltext, TextView.BufferType.SPANNABLE);
Spannable str = (Spannable) view.getText();
int i = fulltext.indexOf(subtext);
str.setSpan(new ForegroundColorSpan(color), i, i + subtext.length(),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment