mercredi 19 août 2015

View html stored in sqlite as text

I'm creating an RSS reader using the SAX Parser in which article details are parsed then stored as SQLite. I am able to return both title and link from the parsed feed (http://ift.tt/1teLdhR), but not the description, which is in Html format.

I was under the impression that it would be stored as a text string and that i could view in textview like this:

TextView descriptionTextView = (TextView)findViewById(R.id.textViewToShowFullArticle);

descriptionTextView.setText(Html.fromHtml(bundle.getString("description")));

However, when i run the app, it returns a null pointer on the above line ^

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference

If i remove Html.fromHtml, i receive a blank textview.

Any help would be much appreciated!

Aucun commentaire:

Enregistrer un commentaire