Draw a line with specified coordonate and clean canvas
<p>I need to draw a line on a layout, for that I read some question here and I use DrawView class, but I need to clean this view at some point, and draw another line on it (or just change the first line's coordonates if possible). </p>

<p>But I don't know how I could do that easily unfortunately the only idea I have is removing the DrawView from the layout and creating another DrawView everytime.</p>

<p>Edit: I tried to use save(); to save the empty canvas, and restore() everytime I need to clean it, but it doesn't seems to work ...</p>

<p>Thanks</p>

<pre><code>public class DrawView extends View {
    Paint paint = new Paint();
    float startX;
    float startY;
    float endX;
    float endY;

    public DrawView(Context context, float startX, float startY, float endX, float endY) {
        super(context);
        paint.setColor(Color.WHITE);
        this.setMinimumHeight(300);
        this.setMinimumWidth(300);

        this.startX = startX;
        this.startY = startY;
        this.endX = endX;
        this.endY = endY;
    }

    @Override
    public void onDraw(Canvas canvas) {
        canvas.drawLine(startX, startY, endX, endY, paint);
    }

}
</code></pre>
