android canvas remove previous path being drawn

view story

http://stackoverflow.com – I am making a drawing app, and would like to implement an undo function to remove the immediate previous drawn path. Coding: private HashMap<Integer, Path> pathMap; // current Paths being drawn private HashMap<Integer, Point> previousPointMap; // current Points private Bitmap bitmap; // drawing area for display or saving private Canvas bitmapCanvas; // used to draw on bitmap // called when the user finishes a touch private void touchEnded(int lineID) { Path path = pathMap.get(lineID); // get the corresponding Path bitmapCanvas.drawPath(path, paintLine); (HowTos)