title: Update GoogleMaps Fragment with changes (or lack thereof)
body: <p>My application has 5 fragments on a tab display, with one being a GoogleMaps Fragment that does work in displaying the map, a location blip of where the user is, and a camera update on that location. However, upon switching between fragments, <strong>my location blip is lost</strong>. </p>
  
  <p>Here is my code, so I can better explain what I'm trying to do:</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      View view = inflater.inflate(R.layout.fragment_map, null, false);
     SupportMapFragment mapFragment = (SupportMapFragment) this.getChildFragmentManager().findFragmentById(R.id.mapView);
      if (mapFragment == null) {
          FragmentManager fragmentManager = getFragmentManager();
          FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
          mapFragment = SupportMapFragment.newInstance();
          fragmentTransaction.replace(R.id.mapView, mapFragment).commit();
      }
      mapFragment.getMapAsync(this);
      return view;
  }
  
  
  public void onMapReady(GoogleMap googleMap) {
      mMap = googleMap;
  
      if (ActivityCompat.checkSelfPermission(getActivity(), 
      Manifest.permission.ACCESS_FINE_LOCATION) == 
      PackageManager.PERMISSION_GRANTED) {
  
      getDeviceLocation();
  
      mMap.setMyLocationEnabled(true);
  
      }
  
  
  }
  </code></pre>
  
  <p>I've tried to implement the <code>getDeviceLocation()</code>, <code>mMap.setMyLocationEnabled(true)</code>, and the surrounding <code>if</code> case that's inside the onMapReady function right before the <code>onCreateView()</code> methods <code>return view;</code> line, but I get a null object reference error (on the <code>mMap</code> object) in the Logcat followed by a crash. This error <strong>only</strong> happens when moving those bits of code elsewhere: <code>setMyLocationEnabled(true)</code> and <code>getDeviceLocation()</code>.</p>
  
  <p>I assume it's because the mMap is still null until the view is retrieved. Basically, how can I keep the location blip maintained from calling the <code>setMyLocationEnabled(true)</code> method without running into the null error reference? Because it doesn't seem like I can implement the location-getting code anywhere that's before <code>return view</code> without getting a null error.</p>
  
  <p>Sorry for the bad formatting and the lengthy question. I just can't figure out how to integrate the Google Maps API code with my own plans, so I'd greatly appreciate <strong>any input</strong> you guys have to offer.</p>