クラスを使用Canvas
Path
Point
して、Google マップにポリラインを描画できます。また、参考のためにこのリンクを見る必要があります 。
List<Overlay> mapOverlay;
protected onCreate(Bundle savedInstanceStae){
//Do the rest stuffs
mapOverlay = mapView.getOverLays();
mapOverlay.add(new MyOverlay());
}
class MyOverLay extends Overlay{
public MyOverlay(){}
ArrayList<GeoPoint> points = new ArrayList<GeoPoint>();
public void draw(Canvas canvas,MapView mv, boolean shadow){
super.draw(canvas,mv,shadow);
Paint mPaint = new Paint();
mPiant.setColor(Color.RED);
//set strokewidth and all function depending upon you how you want to give a look
//on Polyline.
GeoPOint gp1 = new GeoPoint((int) (lat * 1000000.0), (int) (lon * 1000000.0));
GeoPOint gp2 = new GeoPoint((int) (lat * 1000000.0), (int) (lon * 1000000.0));
GeoPOint gp3 = new GeoPoint((int) (lat * 1000000.0), (int) (lon * 1000000.0));
GeoPOint gp4 = new GeoPoint((int) (lat * 1000000.0), (int) (lon * 1000000.0));
points.add(gp1);
points.add(gp2);
points.add(gp3);
points.add(gp4);
//Then take two points class object:
Point point1 = new Point();
Point point2 = new Point();
Path path = new Path();
for(int i = 0; i<points.size(); i++){
projection.toPixel(points.get(i),point1);
projection.toPixel(points.get(i+1),point2);
path.moveTo(point2.x,point2.y);
path.lineTo(point1.x,point1.y);
}
canvas.drawPath(path, mPoint);
}