来自readBundle的Android“错误的魔术数字”错误

| 我一直在使用捆绑软件在我的应用程序中传递我的信息,并偶尔通过先将它们传递到包裹将它们保存到文件中。 出于某种原因,有时当我尝试将它们放回捆中时,以下代码会在我身上产生一个“ readBundle:错误的魔术数”错误:
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();
    
已邀请:

要回复问题请先登录注册