直接上代码,直接看就OK了
for (int i = 0; i < TuJin_List.size(); i++) { LatLng lat = new LatLng(TuJin_List.get(i).getLat(), TuJin_List.get(i).getLongit()); nodes.add(PlanNode.withLocation(lat)); } Log.e("TuJin_List", "TuJin_List=" + TuJin_List.size() + "nodes=" + nodes.size()); // nodes.add(PlanNode.withCityNameAndPlaceName("湖南", "衡阳")); // nodes.add(PlanNode.withCityNameAndPlaceName("武汉", "武昌")); // 实际使用中请对起点终点城s市进行正确的设定 mSearch = RoutePlanSearch.newInstance(); mSearch.setOnGetRoutePlanResultListener(this); mSearch.drivingSearch((new DrivingRoutePlanOption()) .from(stNode).passBy(nodes).to(enNode));