iam using textureView for draw json data like waveform its draw perfect but i want to update the background of the draw onTouch
On ACTION_MOVE
but i faced and problem its made my drawing Flicking this an gif image for the result of course the problem while move View with finger
and this the code was update the background color
case MotionEvent.ACTION_MOVE:
Canvas canvasX = null;
try {
canvasX = surface.lockCanvas(null);
synchronized (surface) {
canvas.save();
mPaint2.setColor(Color.RED);
mPaint2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
canvasX.drawRect(0, 0, event.getRawX() + dX, canvasX.getHeight(),mPaint2);
mPaint.setColor(Color.GREEN);
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
canvasX.drawRect(event.getRawX() + dX, 0, canvasX.getWidth(), canvasX.getHeight(),mPaint);
canvas.restore();
}
} finally {
if (canvasX != null) {
surface.unlockCanvasAndPost(canvasX);
}
}
this.animate()
.x(event.getRawX() + dX)
.setDuration(0)
.start();
break;
any one have an idea about what happen here and how can i solve it