Skip to content Skip to sidebar Skip to footer

Android Textview Cuts Off After One Paragraph

I am creating an app for my school newspaper and am running into a problem when trying to display the full article. Currently I have a list of articles appear that are pulled from

Solution 1:

What you've shown looks correct, but where's the code for your model - RSSFeed? You may want to get some debug output that shows whether your RSS-reading is behaving properly. Maybe you're only getting the summary instead of the full article? Maybe the full article should be read from its own link, not from the abridged RSS feed?

For HTML content, you generally go with the LinkMovementMethod, so links in the content are handled properly. TextViews scroll automatically, assuming you haven't set a TextView.maxLines property (may want to check that).

Also, for simplicity, you should just add/read your data directly from the Intent - there's really no need to go through an intermediary Bundle. putExtra(String,String) and getStringExtra(String) or you can use their CharSequence equivalents, depending on what exactly is output from RSSReader.

EDIT: Are you checking that the TextView scrolls normally displaying dummy text that's longer than 5 lines? You could also try externally copying the Content data from your feed (via an external feed reader) and explicitly putting it in your TextView using TextView.setText(CharSequence) to check whether something in the feed itself is causing your problem.

(Html.fromHtml is based on TagSoup, which is designed to handle even poorly-formed HTML, but you can always try to test with plain-text and see if that works. You can also use the debug log/LogCat to check the before/after of HTML-parsing your RSS feed content.)

If those things have a problem, then it may be an issue with your TextView layout/initialization. If those things all work, then you know the problem is somewhere in your RSS-related code.

Can you post your layout code for the detail view? Also, are you using the emulator or an actual phone? Sometimes the emulator doesn't respond to scrolling gestures quite the same way as an actual device.

EDIT: If it's the RSSHandler that's the problem, I'd suggest creating a separate/new question tagged appropriately (SAX, XML-Parser, RSS). If you post a link here to that new question, I can try to help over there. You can also try first looking for specific answers that might help with the SAX approach to XML parsing. Here's a good tutorial I've been using lately - http://tutorials.jenkov.com/java-xml/sax.html

Post a Comment for "Android Textview Cuts Off After One Paragraph"