Android IllegalAccessException-从非序列化继承的对象的序列化
我得到了android.widget.ImageView;尝试反序列化以前序列化的对象时发生IllegaAccess异常Android IllegalAccessException-从非序列化继承的对象的序列化,android,serialization,deserialization,Android,Serialization,Deserialization,我得到了android.widget.ImageView;尝试反序列化以前序列化的对象时发生IllegaAccess异常 File presetFile = new File("pathToFile"); FileInputStream fis = new FileInputStream(presetFile); ObjectInputStream ois = new ObjectInputStream(fis); P
File presetFile = new File("pathToFile");
FileInputStream fis = new FileInputStream(presetFile);
ObjectInputStream ois = new ObjectInputStream(fis);
Preset preset = (Preset) ois.readObject();
我猜ImageView有一些限制,解释如下:
public class Preset implements Serializable {
private Date dateOfCreation;
private int bpm;
private SoundSwitch[][] switches;
最后是SoundSwitch类标题
public class SoundSwitch extends ImageView implements Serializable{
}
这是因为我继承的ImageView没有实现Serializable吗?我必须放弃反序列化这样的对象吗?这是因为您从中继承的
ImageView
是不可序列化的,并且没有公共的无参数构造函数。显然,它具有受保护的或包访问权限或私有访问权限。@Chris No.从其他东西继承。