2

I've been using bundles to pass my information around my application and occasionally save them to a file by first passing them to a parcel.

For some reason occasionally when I try to put them back into a bundle it springs a "readBundle: bad magic number" error on me generated by the following code:

FileInputStream fis = myContext.openFileInput(name);

    byte[] buff = new byte[2048];
    int length = fis.read(buff,0,2048);
    fis.close();

    Parcel p = Parcel.obtain();
    p.unmarshall(buff, 0, length);
    p.setDataPosition(0);
    return p.readBundle();
isep
  • 703
  • 1
  • 9
  • 24
  • 1
    Maybe this is what you are looking for: http://remotedroid.net/blog/2010/10/13/push-notifications-with-urban-airship-on-android/ – Robert Massaioli Apr 14 '11 at 01:35
  • Yah same error but I think our causes were different. Turns out that someone saved another (nonbundle) file to this area and looping over the filelist causes some issues. I probably should have noticed this sooner but I didnt think of it until I saw the sizes of the "parcels" I was reading in. – isep Apr 14 '11 at 16:21
  • what is your apps JDK version? – Krunal Kapadiya Oct 10 '17 at 03:38

0 Answers0