spannable on android for textView

Tags: , , ,

Tweet o = tweets.get(position);

TextView tt = (TextView) v.findViewById(;
//TextView bt = (TextView) v.findViewById(;         

EditText bt =(EditText)findViewById(;
Spannable spn = (Spannable) bt.getText();
spn.setSpan(new StyleSpan(
, 0, 100, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);  


I’m setting twitter data in my Android application. I want to make the font bold and italic using Spannable but it does not work, giving an error. How can I do it?


I want to make the font bold and ─▒talic with spannable

for this u will need to make o.content text as SpannableString then set it to TextView as :

SpannableString spannablecontent=new SpannableString(o.content.toString());
spannablecontent.setSpan(new StyleSpan(, 
                         0,spannablecontent.length(), 0);
// set Text here

EDIT : you can also use Html.fromHtml for making text Bold and Italic in textview as :


Source: stackoverflow