title: Android: how to notify Activity when Fragments views are ready?
body: <p>I'm using Google Maps API V2 in an activity wih drop down navigation where the map is on the second position.</p>
  
  <p>I'm adding the map pragmatically like:</p>
  
  <pre><code>mMapFragment = supportMapFragment.newInstance();
  getSupportFragmentManager()
          .beginTransaction()
          .replace(R.id.placeHolder, mMapFragment, TAG_MAP)
          .commit(); 
  </code></pre>
  
  <p>I want to get the GoogleMap ovject, as the documentation <a href="https://developers.google.com/maps/documentation/android/map" rel="noreferrer">https://developers.google.com/maps/documentation/android/map</a> say it should be done with <code>mMapFragment.getMap()</code>, but it returns null.</p>
  
  <p>according to <a href="http://developer.android.com/reference/com/google/android/gms/maps/SupportMapFragment.html" rel="noreferrer">http://developer.android.com/reference/com/google/android/gms/maps/SupportMapFragment.html</a>
  it returns null if the Fragment hasn't gone through the onCreateView lifecycle event.</p>
  
  <p>how can I know whenever the fragment is ready  ?</p>
  
  <p>EDIT: I found this <a href="https://stackoverflow.com/questions/14047257/how-do-i-know-the-map-is-ready-to-get-used-when-using-the-supportmapfragment">How do I know the map is ready to get used when using the SupportMapFragment?</a></p>
  
  <p>Overriding onActivityCreated seems like a solution, but then I'll have to instantiate the fragment through a constructor and not with newInstance(), does it make any difference ?</p>