joshdeng / osmbonuspack

Automatically exported from code.google.com/p/osmbonuspack
1 stars 0 forks source link

roadManager.getRoad return null #115

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hey everyone
I am using MapQuestRoadManager for routing but I get the road like null 
although the call  it is working (http://cl.ly/image/111n0Z2j0L40) and return 
info

Anyone have a solution please?

The code is :
RoadManager roadManager = new MapQuestRoadManager("MY KEY");
        ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
        GeoPoint startPoint = new GeoPoint(-0.209317,-78.490003);
        waypoints.add(startPoint);
        GeoPoint endPoint = new GeoPoint(-0.210277,-78.489724);
        waypoints.add(endPoint);
        roadManager.addRequestOption("routeType=pedestrian");
        Road road = roadManager.getRoad(waypoints);
        if (road == null){
            Log.e("Error road", "ROAD NULL");// just return this line 
        }else{
            if (road.mStatus != Road.STATUS_OK){
                Log.e("Error road", "ERROR ROAD");
            }else{
                org.osmdroid.bonuspack.overlays.Polyline roadOverlay = RoadManager.buildRoadOverlay(road,Color.RED,100, this );
                mapView.getOverlays().add(roadOverlay);
                mapView.invalidate();
            }
        }
Android sdk: 21
OSMDROID: 4.3
OSMBonusPack: 5.1

Thank you for your support,
Kind regards,

Original issue reported on code.google.com by fernando...@gmail.com on 21 Mar 2015 at 11:18

GoogleCodeExporter commented 9 years ago
I solved it, with Async task working fine, thanks for this great project

Original comment by fernando...@gmail.com on 22 Mar 2015 at 3:12

GoogleCodeExporter commented 9 years ago

Original comment by mathieu....@gmail.com on 23 Mar 2015 at 9:46