Created
March 16, 2012 16:03
-
-
Save brk3/2050745 to your computer and use it in GitHub Desktop.
De-Serializing Android Paths (http://stackoverflow.com/a/6643686/663370)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private List<SerializablePath> mAddedFPPaths = new ArrayList<SerializablePath>(); | |
public void loadState() { | |
try { | |
FileInputStream fis = mContext.openFileInput(STATE_DATA); | |
ObjectInputStream ois = new ObjectInputStream(fis); | |
try { | |
mAddedFPPaths = (ArrayList<SerializablePath>)ois.readObject(); | |
for (SerializablePath p : mAddedFPPaths) { | |
p.loadPathPointsAsQuadTo(); | |
} | |
} catch (ClassNotFoundException ce) { | |
// ... | |
} | |
ois.close(); | |
} catch (IOException e) { | |
// ... | |
} | |
} | |
// Then in your draw function something like this.. | |
for (SerializablePath p : mAddedFPPaths) { | |
mPaintFP.setColor(p.getColor()); | |
mPaintFP.setStrokeWidth(p.getStrokeWidth()); | |
mPaintFP.setXfermode(null); | |
fpCanvas.drawPath(p, mPaintFP); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi AndroPlus
Did you find a way to store serialized paths in db?
I little help would be great.
Thanks