Is that a restriction on InputStream, or for assets? I was able to include an MP3 file as a resource and it would play just fine (although I didn't open it via InputStream)... the MP3 was about 3mb.
On Aug 13, 12:46 pm, Andrei <[email protected]> wrote: > 1048576 is the file limit > If you have bigger file split it > > On Aug 13, 3:35 pm, Jonathan <[email protected]> wrote: > > > I was able to load a 1MB file okay, but 1.5MB crashed. > > > On Aug 13, 12:30 pm, Jonathan <[email protected]> wrote: > > > > If I truncate the file to 100,000 bytes (file is: 1,917,408 bytes > > > originally) it works fine. Is there a problem with files over a > > > certain size? > > > > On Aug 13, 10:36 am, Jonathan <[email protected]> wrote: > > > > > I'm running into a strange problem while reading from an InputStream > > > > on the Android platform. I'm not sure if this is an Android specific > > > > issue, or something I'm doing wrong in general. > > > > > The only thing that is Android specific is this call: > > > > > InputStream is = getResources().openRawResource(R.raw.myfile); > > > > > This returns an InputStream for a file from the Android assets. > > > > Anyways, here's where I run into the issue: > > > > > bytes[] buffer = new bytes[2]; > > > > is.read(buffer); > > > > > When the read() executes it throws an IOException. The weird thing is > > > > that if I do two sequential single byte reads (or any number of single > > > > byte reads), there is no exception. Ie, this works: > > > > > byte buffer; > > > > buffer = (byte)buffer.read(); > > > > buffer = (byte)buffer.read(); > > > > > Any idea why two sequential single byte reads work but one call to > > > > read both at once throws an exception? The InputStream seems fine... > > > > is.available() returns over a million bytes (as it should). > > > > > Stack trace shows these lines just before the InputStream.read(): > > > > > java.io.IOException > > > > at android.content.res.AssetManager.readAsset(Native Method) > > > > at android.content.res.AssetManager.access$800(AssetManager.java:36) > > > > at android.content.res.AssetManager$AssetInputStream.read > > > > (AssetManager.java:542) > > > > > Changing the buffer size to a single byte still throws the error. It > > > > looks like the exception is only raised when reading into a byte > > > > array. > > > > > Any help is appreciated! Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

