We are using here map android SDK. We don't use layout at all. So we are stock here about how to use it.
First of all, we need to put the map inside a View(or RelativeLayout).
Secondly, when we try to start the map with the following code:
MapFragment map_fragment = null;
//...
map_fragment = new MapFragment();
// how do we add the map_fragment as a "sub-view" of another View/RelativeLayout
map_fragment(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {
if (error == OnEngineInitListener.Error.NONE) {
map_fragment.getMapGesture().
addOnGestureListener(gestureListener);
// throws errors at this line
} else {
}
//...
}
}
It throws an error:
ERROR: Cannot initialize Map Fragment,UNKNOWN,Unknown error occurred.,java.lang.NullPointerException: Cannot initialize with a null Context
I: at com.nokia.maps.ee.a(Preconditions.java:19)
I: at com.nokia.maps.MapsEngine.b(MapsEngine.java:355)
I: at com.nokia.maps.MapsEngine.a(MapsEngine.java:343)
I: at com.here.android.mpa.common.MapEngine.init(MapEngine.java:129)
I: at com.nokia.maps.br.a(MapFragmentImpl.java:126)
I: at com.here.android.mpa.mapping.MapFragment.init(MapFragment.java:108)