Java tutorial
//package com.java2s; //License from project: Apache License import android.text.SpannableString; import android.text.style.ForegroundColorSpan; public class Main { /** * @param text * @param color * @param start * @param end * @return */ public static SpannableString highLight(CharSequence text, int color, int start, int end) { SpannableString span = new SpannableString(text); span.setSpan(new ForegroundColorSpan(color), start, end, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); return span; } }