Is it ok to load a 2M text file to a Java String at runtime?

105 views Asked by At

I have a 2MB text file. I need to read that text file from my app when user launch my app. Can it make cruse in low devices? How many data can I load at runtime?

1

There are 1 answers

0
shkschneider On

That is 16 000 000 bits, of course it's heavy loading, but should work.

As for the limit, the assets loading throws a IOException for a file of more than 1MB, see: https://stackoverflow.com/a/3093966/603270 (since chunked solution).

You can only benchmark on a few devices to get an estimate of the time it will take according to the Android devices out there...