0

我在 Canvas 上画了一张图片,并拥有 PointF 对象的路径和向量。

我将所有 Vector 存储在 Vector> 变量中。

当我尝试存储 pointF 的对象 Vector<Vector>

在一个文件中,我得到一个 IOException,它是不可序列化的,因为它是一个 android.graphics.pointf。

有人对我如何存储这些数据有建议吗?

4

1 回答 1

0

You'll have to use custom serialization. Just convert to a string that let's reconstruct the point. Saving X and Y with the required precision should be enough. For Vector<Vector>> (why are you using Vector at all?) you can use a simple text file (one Vector per line, etc.) or some structured format like JSON or XML. If you really want to use Java serialization, write a wrapper object and implement read/writeObject().

于 2013-01-08T05:56:15.693 回答