How To Get Styled Text From Textview
Quite simple problem: I have some TextView TextView textView = (TextView) findViewById(R.id.textView1); I set styled text (with tags or any other tags) textView.setText
Solution 1:
@Wand Maker's assumption (see comments in question) was correct
Following code works:
TextViewtextView= (TextView) findViewById(R.id.textView1);
textView.setText(Html.fromHtml("Simple text. <b>Bold text</b>. Simple text."), TextView.BufferType.EDITABLE);
StringalmostSameText= Html.toHtml(tv.getEditableText()).toString();
The result is: <p>Simple text. <b>Bold text</b>. Simple text</p>
Post a Comment for "How To Get Styled Text From Textview"