Android 2.1 file reading is slow

779 Views Asked by At

I have an Nook Color (Android 2.1) device and the app which is going to read some huge files (PDFs) from sdcard. I'm going to use FileInputStream for file reading (and it works fine both on emulator and on Android 2.2+ devices). Unfortunately it works painfuly slow (about 25 sec for 125Mb file) while executing the following code:

FileInputStream fileInputStream = new FileInputStream(filename);
fileInputStream.skip(offset);
BitmapFactory.Options options = new BitmapFactory.Options();
Bitmap bitmap = BitmapFactory.decodeStream(fileInputStream, null, options);
fileInputStream.close();
return bitmap;

The file is placed somewhere on sd card. The offset could points to any point at the file (even to the beginning) -- the problem is still in place.

What could be a reason of this performance problem?

1

There are 1 best solutions below

6
On BEST ANSWER

That equates to a read speed of 5mb/s, which is about on par with the speed of MicroSD cards in most Android devices I've used.

Higher end SD cards may get higher performance, but there's nothing in code you can do to speed this up.