Reputation: 83
I have two points , lets say (x1,y1) and (x2,y2). Now i have to draw a line between these points using OnDraw()
method.
I tried as
Paint mPaint = new Paint()
mPaint.setColor(Color.BLACK);
path.moveTo(x1, y1);
path.lineTo(x2, y2);
canvas.drawPath(path, mPaint);
But its not working
Regards,
Sudheer
Upvotes: 0
Views: 4136
Reputation: 22493
Try like this
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, paint);
Upvotes: 5