I am trying to do a simple paint application, but every time I call onDraw it erases what I had there previously. In my on draw I am doing the following (where point is a class with an x and y int, and "points" is a list points):
Paint paint = new Paint();
int c = getPaintFromActivityClass();
paint.setColor(c);
Path path = new Path();
boolean first = true;
for(Point point : points){
if(first){
first = false;
path.moveTo(point.x, point.y);
}
else{
path.lineTo(point.x, point.y);
}
}
canvas.drawPath(path, paint);
I tried adding the "old" path to a new path each time, essentially concatenating the paths to each other and it created separate (not connected) paths. However, in onDraw I am also setting the paint color which is being changed by another view. When I added the paths to each other, changing the color changed the color of all the paths.