title: MapFragment - NullPointerException - Google Maps V2 - Android
body: <p>I'm getting an NullPointerException with the following code: </p>
  
  <pre><code>private ProjectionProxy proxy = new ProjectionProxy();
  private GoogleMap mMap = null;
  private Context context = this;
  
  @Override
  protected void onCreate(Bundle load) { 
      super.onCreate(load);
  
      setContentView(R.layout.fragment_ride_tracking);
  
      //mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.myMapView)).getMap();
  
      mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
  
      int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context);
  
      mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
      mMap.setMyLocationEnabled(true);
  
      //SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.myMapView);
      //mMap = mapFragment.getMap();
  
      Log.e("RideTracking", "Google Map VALUE:"+mMap);
  
      if (mMap != null) { 
          proxy.setProjection(mMap.getProjection());
      }
  </code></pre>
  
  <p>The line where the NullPointerException is happening is this line of code: </p>
  
  <pre><code>mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
  </code></pre>
  
  <p>I'm not initializing my mMap variable to null.  What is my issue here?</p>