I am trying to draw a line between two points that the user chooses on
a map, I am using the Google maps library for this. The user has to
choose from a menu what they want to do so when they press the draw
line button it allows them to choose the two points and it draws the
line. I can get it to draw the line but when you try to draw another
line on the map it deletes the first one and draws the second. I want
every line that is drawn to stay on the map and not to disappear when
the user wants to draw another one. I believe it has something to do
with the Canvas clearing what was there originally. Can anyone help me
with this issue? Below is what I have in my draw method:
Projection projection = mapView.getProjection();
Paint mPaint = new Paint();
mPaint.setDither(true);
mPaint.setColor(Color.GREEN);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(4);
Point p1 = new Point();
Point p2 = new Point();
Path path = new Path();
projection.toPixels(dp1, p1);
projection.toPixels(dp2, p2);
canvas.drawLine(p1.x,p1.y,p2.x,p2.y,mPaint);
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en