MapQuest Maps Android SDK

Setting Coordinates and Camera position

MapQuest Android SDK provides a very powerful set of methods to display the map camera to a specific position. You can center the map at a particular coordinate with zoom level, or tilt the camera for a more 3D perspective.

Set the Map to a Latitude/Longitude

Android with centered map

public class MainActivity extends Activity {
    private final LatLng MAPQUEST_HEADQUARTERS_LOCATION = new LatLng(39.750307, -104.999472);
    private MapView mMapView;
    private MapboxMap mMapboxMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MapQuest.start(getApplicationContext());
        setContentView(R.layout.activity_main);

        mMapView = (MapView) findViewById(R.id.mapquestMapView);

        mMapView.onCreate(savedInstanceState);
        mMapView.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(MapboxMap mapboxMap) {
                mMapboxMap = mapboxMap;
                mMapView.setStreetMode();
                mMapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(MAPQUEST_HEADQUARTERS_LOCATION, 11));
            }
        });
    }

Camera Position and Tilt

CameraPosition position = new CameraPosition.Builder()
          .target(MAPQUEST_HEADQUARTERS_LOCATION) // Sets the new camera position
          .zoom(10) // Sets the zoom to level 10
          .tilt(20) // Set the camera tilt to 20 degrees
          .build(); // Builds the CameraPosition object from the builder
}