title: Here Maps MapView does not work in Fragment
body: <p>I am trying to implement <strong>Here Maps</strong> in <strong>Fragment</strong> but it does not work. I got lots of crashes</p>
  
  <p><strong>Crash Logs:</strong></p>
  
  <pre><code>at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
          Suppressed: java.lang.Throwable: HERE SDK Version: 3.7.0.118
          at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:378)
          at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
          at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
          Suppressed: java.lang.Throwable: HERE SDK Version: 3.7.0.118
          at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:378)
          at com.nokia.maps.MapsEngine$l.uncaughtException(MapsEngine.java:379)
          at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
          at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
       Caused by: com.here.android.mpa.common.UnintializedMapEngineException: Cannot create HERE SDK object before MapEngine is initialized. See MapEngine.init()
          at com.nokia.maps.BaseNativeObject.u(BaseNativeObject.java:39)
          at com.nokia.maps.BaseNativeObject.&lt;init&gt;(BaseNativeObject.java:26)
          at com.nokia.maps.MapImpl.&lt;init&gt;(MapImpl.java:424)
          at com.here.android.mpa.mapping.Map.&lt;init&gt;(Map.java:710)
          at ie.globetech.transitconnex.activity.bustrips.BusTripFragment.onEngineInitializationCompleted(BusTripFragment.java:179)
          at com.here.android.mpa.common.MapEngine.init(MapEngine.java:279)
          at ie.globetech.transitconnex.activity.bustrips.BusTripFragment.onCreate(BusTripFragment.java:136)
          at android.support.v4.app.Fragment.performCreate(Fragment.java:2331)
          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1386)
          at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1188)
          at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1071)
          at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:115)
          at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2380)
          at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2338)
          at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2245)
          at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3248)
          at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3200)
          at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:195)
          at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:597)
          at ie.globetech.transitconnex.activity.bustrips.BusTripMainActivity.onStart(BusTripMainActivity.java:125)
          at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
          at android.app.Activity.performStart(Activity.java:6965)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2934)
              ... 9 more
  </code></pre>
  
  <p><strong>Fragment Layout:</strong></p>
  
  <pre><code>&lt;com.here.android.mpa.mapping.MapView
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_alignParentTop="true" /&gt;
  </code></pre>
  
  <p><strong>Fragment class:</strong></p>
  
  <pre><code>    public class BusTripFragment extends Fragment{
  
             private Activity mActivity;
             private Map map = null;
             private MapView mapView;
  
               @Override
                  public void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      ApplicationContext appContext = new ApplicationContext(mActivity.getApplicationContext());
                      MapEngine.getInstance().init(appContext, this);
  
                }
  
   @Override
      public void onAttach(Activity activity) {
          super.onAttach(activity);
          try {
              mActivity = (Activity) activity;
              //mCallbacks = (MyNavigationDrawerCallbacks) activity;
          } catch (ClassCastException e) {}
      }
  
  
          @Override
              public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                  View view = inflater.inflate(R.layout.trip_fragment, container, false);
                 mapView = (MapView) view.findViewById(R.id.map);
                 return view;      
                  }
  
      @Override
          public void onEngineInitializationCompleted(Error error) {
  
              // retrieve a reference of the map from the map fragment
              //map = mapFragment.getMap();
  
              isMapEngineInitialized = true;
  
              if (map == null) {
                  map = new Map();
              }
  
              mapView.setMap(map);
  
              // Set the map center to the Vancouver region (no animation)
              map.setCenter(new GeoCoordinate(49.196261, -123.004773, 0.0), Map.Animation.NONE);
  
              // Set the zoom level to the average between min and max
              map.setZoomLevel((map.getMaxZoomLevel() + map.getMinZoomLevel()) / 2);
          }
  
       }
  </code></pre>
  
  <p>I am using HERE SDK Version: 3.7.0.118</p>
  
  <p>I want through below therads</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/35506270/here-map-mapview-without-using-mapfragment">HERE Map/MapView without using MapFragment</a></li>
  </ol>
  
  <p>Any one has any idea how to deal with Here Maps MapView in Fragment ?</p>