これを試して、Googleマップでパスを描画します
public class Location extends MapActivity {
MapView mapView;
public static ArrayList<String> paramLat = new ArrayList<String>();
public static ArrayList<String> paramLong = new ArrayList<String>();
private List<Overlay> mapOverlays;
public List<GeoPoint> geopoints = new ArrayList<GeoPoint>();
public void onCreate(Bundle savedInstanceState) {
//your code to display location
for(int i=0;i<paramLat.size();i++)
{
lat = Double.parseDouble(paramLat.get(i));
lon = Double.parseDouble(paramLong.get(i));
geoPoint = new GeoPoint((int)(lat * 1E6), (int)(lon *1E6));
geopoints.add(geoPoint);
}
mapOverlays = mapView.getOverlays();
mapOverlays.add(new MyOverlay());
}
class MyOverlay extends Overlay{
public MyOverlay(){
}
public void draw(Canvas canvas, MapView mapv, boolean shadow){
super.draw(canvas, mapv, shadow);
int loopcount = geopoints.size() - 1;
Paint mPaint = new Paint();
mPaint.setDither(true);
mPaint.setColor(Color.BLUE);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(2);
for (int i = 0; i < loopcount; i++)
{
GeoPoint pp1 = (GeoPoint) geopoints.get(i);
GeoPoint pp2 = (GeoPoint) geopoints.get(i + 1);
Point p1 = new Point();
Point p2 = new Point();
Path path = new Path();
projection.toPixels(pp1, p1);
projection.toPixels(pp2, p2);
path.moveTo(p2.x, p2.y);
path.lineTo(p1.x,p1.y);
canvas.drawPath(path, mPaint);
}
}
} //end of MyOverlay class
} //end of Location class