Android examples for android.text:SpannableString
Create Spannable String from text, color, start end
import android.graphics.Color; import android.text.SpannableString; import android.text.Spanned; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.DecimalFormat; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static SpannableString getSpecialSpannableString(String color, String text, int start, int end) { SpannableString mSpannableString = new SpannableString(text); mSpannableString.setSpan(// w w w . j a v a2s. c om new ForegroundColorSpan(Color.parseColor(color)), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); return mSpannableString; } }