<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<meta-data android:name="com.here.android.maps.appid" android:value="RntXgSL6TAZaZqm8v6Ac"/>
<meta-data android:name="com.here.android.maps.apptoken" android:value="a8nz9XJZ_mgMq44jD4idMQ"/>

<LinearLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:orientation="vertical" >

 <fragment
  class="com.here.android.mapping.MapFragment"
  android:id="@+id/mapfragment"
  android:layout_width="match_parent"
  android:layout_height="match_parent" />

</LinearLayout>

public class MapActivity extends Activity {
    // ... 
    private Map map;
    private MapFragment mapFragment;

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

        mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.mapfragment);
        mapFragment.init(new FragmentInitListener() {
            @Override
            public void onFragmentInitializationCompleted(InitError error) {
                if (error == InitError.NONE) {
                    map = mapFragment.getMap();
                    map.setCenter(MapFactory.createGeoCoordinate(43.17, 5.22, 0.0), MapAnimation.NONE);
                    map.setZoomLevel((map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
                } else {
                    Log.i(TAG, "Erreur à l'init de la carte");
                }
            }
        });
    }
}

<LinearLayout
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:orientation="horizontal"
 android:layout_gravity="center_horizontal" >
  <Button
   android:id="@+id/homebutton"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:onClick="goHome"
   android:text="@string/label_button_gohome" />
  <Button
   android:id="@+id/schemebutton"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:onClick="changeScheme"
   android:text="@string/label_button_changescheme" />
</LinearLayout>

public void goHome(View view) {
 if (map != null) {
  map.setCenter(MapFactory.createGeoCoordinate(43.17, 5.22, 0.0), MapAnimation.NONE);
  map.setZoomLevel((map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
  map.setOrientation(0);
  map.setTilt(0);
  map.setMapScheme(initialScheme);
 }
}

public void changeScheme(View view) {
 if (map != null) {
  String current = map.getMapScheme();

  if (initialScheme == null || initialScheme.isEmpty()) {
   initialScheme = current;
  }

  List<String> schemes = map.getMapSchemes();
  int total = map.getMapSchemes().size();

  if (schemes.get(total - 1).equals(current))
   map.setMapScheme(schemes.get(0));
  else {
   for (int count = 0; count < total - 1; count++) {
    if (schemes.get(count).equals(current))
     map.setMapScheme(schemes.get(count + 1));
   }
  }
 }
}

<TextView
 android:id="@+id/title"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/textview_routecoordinates_2waypoints" />

<LinearLayout
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="center_horizontal"
 android:orientation="horizontal" >

 // home button et scheme button ...

 <Button
  android:id="@+id/directionsbutton"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:onClick="getDirections"
  android:text="@string/label_button_getdirections" />
</LinearLayout>

private RouteManagerEventListener routeManagerEventListener = new RouteManagerEventListener() {
 public void onCalculateRouteFinished(RouterError errorCode, List<RoutingResult> result) {
  if (errorCode == RouterError.NONE && result.get(0).getRoute() != null) {
   mapRoute = MapFactory.createMapRoute(result.get(0).getRoute());
   map.addMapObject(mapRoute);
   GeoBoundingBox gbb = result.get(0).getRoute().getBoundingBox();
   map.zoomTo(gbb, MapAnimation.NONE, Map.MOVE_PRESERVE_ORIENTATION);
   textViewResult.setText(String.format("Route calculated with %d maneuvers.", result.get(0).getRoute().getManeuvers().size()));
  } else {
   textViewResult.setText(String.format("Route calculation failed: %s", errorCode.toString()));
  }
 }

 public void onProgress(int percentage) {
  textViewResult.setText(String.format("... %d percent done ...", percentage));
 }
};

public void getDirections(View view) {
 textViewResult.setText("");
 
 if (map != null && mapRoute != null) {
  map.removeMapObject(mapRoute);
  mapRoute = null;
 }

 RouteManager routeManager = MapFactory.getRouteManager();
 RoutingMode routingMode = MapFactory.createRoutingMode();
 routingMode.setRoutingOptions(EnumSet.noneOf(RoutingOptions.class));
 routingMode.setTransportMode(TransportMode.CAR);
 routingMode.setRoutingType(RoutingType.FASTEST);

 WaypointParameterList waypointParameterList = MapFactory.createWaypointParameterList();
 waypointParameterList.addCoordinate(MapFactory.createGeoCoordinate(43.17,5.22));
 waypointParameterList.addCoordinate(MapFactory.createGeoCoordinate(43.69,7.26));

 routeManager.calculateRouteAsync(waypointParameterList, routingMode,routeManagerEventListener);
}