title: Unable to start activity ComponentInfo with Mainactivity and Navigation drawer?
body: <p>I'm having issues with my MainActivity starting and fragment navigation drawer working with google maps. The error i'm getting is actually two errors in one and looks like this: </p>
  
  <p><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.examples.blahblah.blahblah/com.examples.blahblah.blahblah.MainActivity2Activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.maps.MapFragment.getMapAsync(com.google.android.gms.maps.OnMapReadyCallback)' on a null object reference</code></p>
  
  <p>Now I believe this is something to do with my fragment file which looks like this:</p>
  
  <pre><code>    package com.examples.blahblah.blahblah;
  
  import android.app.Fragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapFragment;
  import com.google.android.gms.maps.OnMapReadyCallback;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  
      public class menu_1_fragment extends Fragment implements OnMapReadyCallback {
  
          View rootview;
  
          public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              rootview = inflater.inflate(R.layout.menu1_layout, container, false);
  
              MapFragment mapFragment = (MapFragment) getFragmentManager()
                      .findFragmentById(R.id.map);
              mapFragment.getMapAsync(this);
  
              return rootview;
          }
  
          @Override
          public void onMapReady(GoogleMap map) {
              LatLng sydney = new LatLng(-33.867, 151.206);
  
              map.setMyLocationEnabled(true);
              map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));
  
              map.addMarker(new MarkerOptions()
                      .title("Sydney")
                      .snippet("The most populous city in Australia.")
                      .position(sydney));
          }
      }
  </code></pre>
  
  <p>But I will post my MainActivity if anybody thinks it could be that could be the reason I'm getting this error instead. But I wasn't getting this error until I started changing my Fragment file. </p>
  
  <p>Edit: Updated Code Having issues with getSupportFragment</p>
  
  <pre><code>    import android.app.Fragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapFragment;
  import com.google.android.gms.maps.OnMapReadyCallback;
  import com.google.android.gms.maps.SupportMapFragment;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  
      public class menu_1_fragment extends Fragment implements OnMapReadyCallback {
  
          View rootview;
  
          public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              rootview = inflater.inflate(R.layout.menu1_layout, container, false);
  
  
              return rootview;
          }
  
          public void onActivityCreated(Bundle savedInstanceState) {
              super.onActivityCreated(savedInstanceState);
              SupportMapFragment mapFragment = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map));
              mapFragment.getMapAsync(this);
          }
  
          @Override
          public void onMapReady(GoogleMap map) {
              LatLng sydney = new LatLng(-33.867, 151.206);
  
              map.setMyLocationEnabled(true);
              map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));
  
              map.addMarker(new MarkerOptions()
                      .title("Sydney")
                      .snippet("The most populous city in Australia.")
                      .position(sydney));
          }
      }
  </code></pre>