private Map<String, List<DrawPath>> savedPath= new LinkedHashMap<String, List<DrawPath>>();
我想写这个&#34; savedPath&#34;提交,但抛出IOException:
public static class DrawPath implements Serializable{
/**
*
*/
public static final long serialVersionUID = 1L;
public Path path;
public Paint paint;
}
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(sdFile));
out.writeObject(savedPath); // throws IOExcption
如果更改为Map<String, String>
,它是否成功,是否与我的自定义DrawPath类相关?如何将此对象写入文件成功?感谢
答案 0 :(得分:1)
确保您写入文件的所有对象都是Serializable,保存Paint可能是问题