0

Is it possible to work with I/O-files that're >=16MB on Android? Currently I'm using the new Java NIO-API (FileChanel), split the array using System.arraycopy and put the chunks into a collection. If the files is >= 16MB, the thread throws an OutOfMemoryError.

Any suggestions? The normal I/O-API was way to slow.

Thanks in advance.

chollinger
  • 1,097
  • 5
  • 20
  • 34

1 Answers1

1

The problem is that Android applications have limit of 16MB RAM per application - thus you get the out of memory exception. Currently if you want to support the most common Android versions you can not avoid this limitations. You will need to process the file in parts.

Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135
  • The max heap size varies between devices btw. – Jens Feb 13 '12 at 12:49
  • True. See here: http://stackoverflow.com/questions/3590443/what-is-the-maximum-memory-limits-per-application-for-android-2-2. However 16Mb is the limit for the most common devices. – Boris Strandjev Feb 13 '12 at 12:58