Alex Rivera | Logout

Android :getting [OBJ] using Textview.SetText(characterSequence)

Asked 2011-12-19T10:33:53.003
16

I am getting [OBJ] displayed on the screen when I try to set a ImageSpan on a text View..it shows a /uFFFC unicode character instead of the image on the screen,i.e. a dotted box with OBJ written inside it.

Edit
Report

1 Answer

28

I faced the same problem, thus I just wanted to have the HTML stripped and just get the String.

The solution is probably not the most beautiful one, but still pretty pragmatical:

public CharSequence stripHtml(String s) {
    return Html.fromHtml(s).toString().replace('\n', (char) 32)
        .replace((char) 160, (char) 32).replace((char) 65532, (char) 32).trim();
}

This [OBJ] character seemed to be (char) 65532.

I had to display a very ugly RSS item's (HTML) description field in a TextView without formats. The hypertext contained a lot of WYSIWYG debris like <p></p><p></p>…

answered 2012-05-14T09:53:06.967

Your Answer