Color the content in double quotation marks:
Private void highlightsearchhint (spannable hintspan ){
String hint = hintspan. tostring ();
Log. I (TAG, "highlightsearchhint" + hint );
Int Index =-1;
Int start = 0;
Boolean foundstartquote = false;
Do {
Index = hint. indexof ("/" ", index + 1 );
If (foundstartquote & Index! =-1 ){
Foundstartquote = false;
Log. I (TAG, "highlight from" + (start + 1) + "to" + index );
/* Each setspan must use a new foregroundcolorspan object */
Foregroundcolorspan hintcolor = new foregroundcolorspan (color. parsecolor ("# 01a8ff "));
Hintspan. setspan (hintcolor, start + 1, index,
Spannable. span_exclusive_exclusive );
} Else if (! Foundstartquote & Index! =-1 ){
Foundstartquote = true;
Start = index;
}
} While (index! =-1 );
}
// Create a spannablestring object
Spannablestring sp = new
Spannablestring (
"Click Google link: italic ."
);
// Set a hyperlink between 2 and 3 Characters
Sp. setspan (New
Urlspan (
Http://www.google.com"
),
2
,
4
,
Spanned. span_exclusive_exclusive );
// Set italic on 7-8 characters
Sp. setspan (New
Stylespan (Android. Graphics. typeface. bold_italic ),
7
,
9
, Spannable. span_exclusive_inclusive );