What would be the best way of reading large text files from the
sdcard?

Right now I'm using this in my browser activity:

File f = new File(filePath);
FileInputStream file = new FileInputStream(f);
BufferedReader in = new BufferedReader(new InputStreamReader(file));
do {
        st = in.readLine();
        vector.add(st);
} while (st != null);
in.close();

and in the other activity where I want to edit the file I have:

char lf = 10;
int k = 0;
String s = null;
for (int i = 0; i < browseractivity.vector.size(); i++) {
        s = browseractivity.vector.get(k);
        if (s != null) {
                editText.append(s);
                editText.append(String.valueOf(lf));
        }
        k++;
}

When trying this on a file of 24648 bytes which corresponds to 24097
chars on 555 lines
I looked in Notepad++ at which characters it cuts.
It displays 8764 characters which corresponds exactly to 9000 bytes
and 237 lines

Does any one have a better suggestion of how to do this so I can read
larger files?

//André

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to