Search code examples
androidmapquest

Finding the route display for map in android mobile


What I am doing::

  • I am using MapQuest in android for location
  • I want to know the route map between two locations
  • What i am using: I used this link

What I want::

  • as we can see we are achieving using address as strings .....
  • Is it possible to achieve the same below code functionality using latitude and longitude passing

Code::

public class MyRouteMap extends MapActivity {
    protected MapView map;

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

    // set your map and enable default zoom controls 
    private void setupMapView() {
      this.map = (MapView) findViewById(R.id.map);
      map.setBuiltInZoomControls(true);
    }

    // create a route and display on the map 
    private void displayRoute() {
      RouteManager routeManager = new RouteManager(this);
      routeManager.setMapView(map);
      routeManager.createRoute("San Francisco, CA", "Fremont, CA");
    }

    @Override
    public boolean isRouteDisplayed() {
      return true;
    }
  }

enter image description here


Solution

  • I found this example in the mapquest forum http://developer.mapquest.com/web/products/forums/-/message_boards/view_message/255724

    routeManager.createRoute("{latLng:{lat:37.765007,lng:-122.239937}}","Fremont, CA");