title: Google Maps Error trying to invoke 'com.google.android.gms.maps.model.Marker
body: <p>I'm trying to get my current location and set a marker on the map with the current location. I put that Toast just to see if the app is retrieving latitude and longitude, and it is, that Toast is working perfectly. The only problem is on the addMarker and the moveCamera, both are showing the same error on logcat.</p>
  
  <p>Can someone please help me? I haven't found any explanation of that error on Google(Not the <code>NullPointException</code>, I have found plenty of this one)   </p>
  
  <p>Here's the MapsActivty:</p>
  
  <pre><code>public GoogleMap mMap;
  double latitude = 0;
  double longitude = 0;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_maps);
      SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
              .findFragmentById(R.id.map);
  
      LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  
      locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, (LocationListener) this);
  }
  
  public void onLocationChanged(Location location) {
      // TODO Auto-generated method stub
  
     latitude = location.getLatitude();
      longitude = location.getLongitude();
  
      String text = "Geo_Location \nLatitude: " + latitude + "\nLongitude: " + longitude;
      Toast.makeText(this, text, Toast.LENGTH_LONG).show();
  
      LatLng myLocation = new LatLng(location.getLatitude(), location.getLongitude());
      mMap.addMarker(new MarkerOptions().position(myLocation).title("Marker in currentLocation"));
      mMap.moveCamera(CameraUpdateFactory.newLatLng(myLocation));
  }
  </code></pre>
  
  <p>And here's the logcat error:</p>
  
  <pre><code>03-17 17:26:50.857 13753-13753/com.example.casa.gps E/AndroidRuntime: FATAL EXCEPTION: main
                                                                    Process: com.example.casa.gps, PID: 13753
                                                                    java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.model.Marker com.google.android.gms.maps.GoogleMap.addMarker(com.google.android.gms.maps.model.MarkerOptions)' on a null object reference
  </code></pre>