Code example for ForegroundColorSpan

0
         * Add color to a given text 
         */ 
        private SpannableStringBuilder addColor(CharSequence text, int color) {
            SpannableStringBuilder builder = new SpannableStringBuilder(text);
            if (color != 0) {
                builder.setSpan(new ForegroundColorSpan(color), 0, text.length(),
                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            } 
            return builder;
        } 
 
        /** 
         * @return the {@link RemoteViews} for a specific position in the list. 
         */ 
        @Override 
        public RemoteViews getViewAt(int position) {
            if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) {
                Log.v(TAG, "getViewAt position: " + position);
            } 
            synchronized (sWidgetLock) {
                // "View more conversations" view.