Android 在谷歌地图上绘制两点之间的路径

Android 在谷歌地图上绘制两点之间的路径,android,overlay,kml,google-maps-api-2,Android,Overlay,Kml,Google Maps Api 2,我正在安卓谷歌地图上工作。我经历了 如果距离超过200公里,我无法绘制两点之间的完整路径。如何在两点之间绘制完整路径?许可证是否存在任何问题,如果存在任何许可证问题,我如何获得许可证 感谢首次创建活动时调用的/***/ /** Called when the activity is first created. */ private List<Overlay> mapOverlays; private Projection projection; @Override pub

我正在安卓谷歌地图上工作。我经历了

如果距离超过200公里,我无法绘制两点之间的完整路径。如何在两点之间绘制完整路径?许可证是否存在任何问题,如果存在任何许可证问题,我如何获得许可证

感谢首次创建活动时调用的

/***/
/** Called when the activity is first created. */
private List<Overlay> mapOverlays;

private Projection projection;  

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    linearLayout = (LinearLayout) findViewById(R.id.zoomview);
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    mapOverlays = mapView.getOverlays();        
    projection = mapView.getProjection();
    mapOverlays.add(new MyOverlay());        

}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

class MyOverlay extends Overlay{

    public MyOverlay(){

    }   

    public void draw(Canvas canvas, MapView mapv, boolean shadow){
        super.draw(canvas, mapv, shadow);

    Paint   mPaint = new Paint();
        mPaint.setDither(true);
        mPaint.setColor(Color.RED);
        mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        mPaint.setStrokeJoin(Paint.Join.ROUND);
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setStrokeWidth(2);

        GeoPoint gP1 = new GeoPoint(19240000,-99120000);
        GeoPoint gP2 = new GeoPoint(37423157, -122085008);

        Point p1 = new Point();
        Point p2 = new Point();

    Path    path = new Path();

    Projection  projection.toPixels(gP1, p1);
        projection.toPixels(gP2, p2);

        path.moveTo(p2.x, p2.y);
        path.lineTo(p1.x,p1.y);

        canvas.drawPath(path, mPaint);
    }
私有列表覆盖图; 私人投影; @凌驾 创建时的公共void(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); linearLayout=(linearLayout)findViewById(R.id.zoomview); mapView=(mapView)findViewById(R.id.mapView); mapView.SetBuilTinZoomControl(真); mapOverlays=mapView.getOverlays(); projection=mapView.getProjection(); 添加(新的MyOverlay()); } @凌驾 受保护的布尔值isRouteDisplayed(){ 返回false; } 类MyOverlay扩展覆盖{ 公共MyOverlay(){ } 公共空白绘制(画布、MapView mapv、布尔阴影){ super.draw(画布、贴图、阴影); Paint mPaint=新油漆(); mPaint.setDither(true); mPaint.setColor(Color.RED); mPaint.setStyle(绘制、样式、填充和笔划); mPaint.setStrokeJoin(油漆.连接.圆形); mPaint.setStrokeCap(油漆盖圆形); mPaint.设定行程宽度(2); 地质点gP1=新的地质点(19240000,-99120000); 地质点gP2=新的地质点(37423157,-122085008); 点p1=新点(); 点p2=新点(); 路径路径=新路径(); 顶像素(gP1,p1); 顶像素投影(gP2,p2); path.moveTo(p2.x,p2.y); lineTo路径(p1.x,p1.y); canvas.drawPath(路径,mPaint); }
我使用Google map android API v2在两点之间绘制了一条路径。我在该链接上发布了它的解决方案。

使用Google导航URI和源和目标lat/lon