Getting started with here-api – Initializing the Map Fragment

When you have defined the basic layout of the application and acquired necessary permissions, the final step is to initialize the instance of the MapFragment class, thus creating and associating a Map with the MapFragment declared in the activity_main.xml file.

public class BasicMapActivity extends Activity {

  // map embedded in the map fragment
  private Map map = null;

  // map fragment embedded in this activity
  private MapFragment mapFragment = null;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initialize();
  }

  private void initialize() {
    setContentView(R.layout.activity_main);

    mapFragment = (MapFragment)getFragmentManager().findFragmentById(R.id.mapfragment);
    mapFragment.init(new OnEngineInitListener() {
      @Override
      public void onEngineInitializationCompleted(OnEngineInitListener.Error error)
      {
        if (error == OnEngineInitListener.Error.NONE) {
          map = mapFragment.getMap();  
          map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0),
                  Map.Animation.NONE);  
          map.setZoomLevel(
            (map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
        } else {
          System.out.println("ERROR: Cannot initialize Map Fragment");
        }
      }
    });
  }
}

if you want to reproduce, please indicate the source:
Getting started with here-api – Initializing the Map Fragment - CodeDay