I'm writing an Android app that reads a single text file and display it on a TextView
.
What I'm doing right now is read the whole file into a String (using BufferedReader
and StringBuilder
) and display it on a TextView
using setText(string)
. A 700KB text file can take about 2 to 3 seconds before it is being displayed on the screen.
But I've used some other ebook readers on the market and they can display the same text almost instantly. Anyone know how I can achieve this?
Thanks you.
Edit: Many suggest ListView, but it doesn't work for my particular case. This is from my reply to one of the answer: ...[ListView] doesn't work for me for a few reasons. (1) To make the Listview look like a TextView, we have to break the text up on new line character. If I load a single large paragraph, it's just as slow as a loading a TextView. (2) Since a ListView only measures the item on the screen, I cannot know ahead of time the total 'pages' or 'height' of the entire text.