Code example for StyleSpan

0
    return this;
  } 
 
  public StyleableSpannableStringBuilder appendBold(CharSequence text) {
//    Log.d(TAG, "appendBold: " + text); 
    return appendWithStyle(new StyleSpan(Typeface.BOLD), text);
  } 
 
  public StyleableSpannableStringBuilder appendGreen(CharSequence text) {
//    Log.d(TAG, "appendGreen: " + text); 
//    return appendWithStyle(new ForegroundColorSpan(Color.GREEN), text); 
    return appendWithStyle(new ForegroundColorSpan(context.getResources().getColor(R.color.green)), text);
  } 
 
  public StyleableSpannableStringBuilder appendOrange(CharSequence text) {
//    Log.d(TAG, "appendOrange: " + text); 
//    final ForegroundColorSpan c = new ForegroundColorSpan(Color.RED); 
 
 
    final Resources resources = context.getResources();