Draw a smooth line with finger touch on android. I set line's properties at first. I try many things. But still not working. My device is galaxy note 10.1 and G2.
public CanvasClass(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
mPaint = new Paint();
this.mPaint.setColor(Color.BLACK);
this.mPaint.setStrokeWidth(8);
this.mPaint.setAntiAlias(true);
this.mPaint.setDither(true); // enable dithering
this.mPaint.setStyle(Paint.Style.FILL); // set to STOKE
this.mPaint.setStrokeJoin(Paint.Join.ROUND); // set the join to round you want
this.mPaint.setStrokeCap(Paint.Cap.ROUND); // set the paint cap to round too
}
/////////////////////////////////////////////////////////////////
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
if(!pointList.isEmpty())
for(int i =0; i<pointList.size();i++){
if(!pointList.get(i).getIsDown())
canvas.drawLine(this.pointList.get(i-1).getValueX(), this.pointList.get(i-1).getValueY(), this.pointList.get(i).getValueX(), this.pointList.get(i).getValueY(), this.mPaint);
}
}