开发者

Android "Bad magic number" error from readBundle

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 i开发者_开发知识库nto 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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜