Yay, nay? Anyone?
I can't believe this doesn't exist already, but I spent quite awhile looking and haven't found anything quite like it yet.
What I need is very simple; I want to be able to input any GPS coordinates, and then all I want is a direction arrow and a distance to the coordinates.
Yay, nay? Anyone?
I have that one; it doesn't do what I want.
It is great for telling me what my current coordinates are, but that's not what I need.
MyLocation works as well.
Spring Framework
Last edited by arulife; 12-06-2011 at 06:16 AM.
if u want to find distance to the given co-ordinates, make a geoPoint object , instantiate it with lat and long, and use the methode distanceBetween(p1, p2); methode, that will solve the problem![]()
for the showing a direction arrow,, i am pasting the code that i used below, it draws staright line on the convase
class MapOverlay extends Overlay
{
private final int mRadius = 5;
private GeoPoint myGeoPoint;
static GeoPoint geoPoint1,geoPoint2;
private String name;
//private boolean isSelf;
public MapOverlay(GeoPoint geoPoint1, String name)//, boolean isSelf)
{
this.myGeoPoint = geoPoint1;
this.name = name;
}
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow)
{
Projection projection = mapView.getProjection();
if (shadow == false)
{
Point screenPoint = new Point();
projection.toPixels(myGeoPoint, screenPoint);
RectF oval = new RectF(screenPoint.x - mRadius, screenPoint.y - mRadius,
screenPoint.x + mRadius, screenPoint.y + mRadius);
Paint paint = new Paint();
paint.setARGB(250, 255, 255, 255);
paint.setAntiAlias(true);
paint.setFakeBoldText(true);
Paint backPaint = new Paint();
backPaint.setARGB(175, 50, 50, 50);
backPaint.setAntiAlias(true);
backPaint.setColor(Color.RED);
backPaint.setAlpha(150);
RectF backRect = new RectF(screenPoint.x + 2 + mRadius,
screenPoint.y - 3*mRadius,
screenPoint.x + 65, screenPoint.y + mRadius);
canvas.drawOval(oval, paint);
canvas.drawRoundRect(backRect, 5, 5, backPaint);
canvas.drawText(name,
screenPoint.x + 2*mRadius, screenPoint.y,
paint);
Paint mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.BLUE);
mPaint.setStrokeWidth(2);
Point point1 = new Point();
projection.toPixels(geoPoint1, point1);
Point point2 = new Point();
projection.toPixels(geoPoint2, point2);
/// here is the code line that u asked for drawing error, modifiy it to arror, as it shows straight line
canvas.drawLine((float) point1.x, (float) point1.y, (float) point2.x,
(float) point2.y, mPaint);
}
}
}// end of OverLay class
Bookmarks