views:

112

answers:

1

Trying to read an utf-8 encoded file in android...

InputStreamReader reader = new InputStreamReader(assets.open("data.txt"), "UTF-8");
BufferedReader br = new BufferedReader(reader); 
String line;
//The line below throws an IOException!!
line = br.readLine();

What's wrong with this code?

+1  A: 

It looks like you file is too big, you have to split it onto several files (1048576 bytes maximum for each) or find another way to reduce file size. Here is an article about similar problem http://androidgps.blogspot.com/2008/10/dealing-with-large-resources.html

Konstantin Burov