hi i am trying to add undo feature to finger paint example given in API demo. but i am not able to achieve it. So far i have added all the path that are drawn in a list and redrawing it to the canvas except the last path. But it is not working. Any clue where i am going wrong.
Edit #1: My Undo Method is this
private void undo(){
if (MyPathList.size()>0) {
mCanvas.drawColor(0xFFFFFFFF);
for (int i = 0; i < MyPathList.size()-1; i++) {
Path p=(Path)MyPathList.get(i);
mCanvas.drawLine(0, 0, 20, 20, mPaint);
mCanvas.drawLine(0, 0, 80, 20, mPaint);
mCanvas.drawPath(p, mPaint);
p.reset();
}
invalidate();
}
}
Thanks in Advance.