How to draw on Canvas using multi-threading?
<p>I have been developing the application for drawing, and there is the following code for it:</p>

<pre><code>public class PainterView extends View implements DrawingListener {

private Context context;
private Painter painter;
private Bitmap background;
private Bitmap bitmap;
private Paint bitmapPaint;
private Path path;
private Paint paint;

private float x;
private float y;

public PainterView(Context context, Painter painter) {

    super(context);
    this.context = context;
    this.painter = painter;
}

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
}

@Override
protected void onDraw(Canvas canvas) {
    if (bitmap != null) {
        canvas.drawBitmap(background, 0, 0, bitmapPaint);
        canvas.drawBitmap(bitmap, 0, 0, bitmapPaint);
        canvas.drawPath(path, paint);
    }
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    x = event.getX();
    y = event.getY();
    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
        painter.touchStart(x, y);
        break;
    case MotionEvent.ACTION_MOVE:
        painter.touchMove(x, y);
        break;
    case MotionEvent.ACTION_UP:
        painter.touchUp();
        break;
    }
    return true;
}

@Override
public void onPictureUpdate(Bitmap background, Bitmap bitmap, Paint bitmapPaint, Path path, Paint paint) {
    this.background=background;
    this.bitmap = bitmap;
    this.bitmapPaint = bitmapPaint;
    this.path = path;
    this.paint = paint;
    invalidate();
}

public void setPainter(Painter painter) {
    this.painter = painter;
}
}
</code></pre>

<p>This code catches all touch event, send this event to model, this save coordinates and send bitmap to view for drawing. </p>

<p>I'm using this code, and it is working good, but my client tells me that drawing is not smooth breaks or missing at some places. So I need to use multithreading for it. So, please, tell me, how I can do it? Or may I increase the productivity using another way?</p>
