我得到一个带有以下代码的 NotSerializableException ,但我不知道为什么:
private class Entry implements Serializable {
public int mProgress, mReps;
public int mDays;
public String[] mEntry;
public Entry() {
mEntry = new String[2];
mProgress = mReps = 0;
mDays = 0;
}
}
private HashMap<String,Entry> mEntries;
FileOutputStream fos = mApp.openFileOutput("FOO", Context.MODE_PRIVATE);
ObjectOutputStream os = new ObjectOutputStream(fos);
os.writeObject(mEntries);
os.close();
我发现了上述 4 行之一中发生的异常:
保存异常 java.io.NotSerializableException: com.company.app.classname