title: Android Google Map Fragment in another Fragment
body: <p>I can't seem to be able to add google map inside a fragment. Here's my code</p>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.example.test.MainActivity"&gt;
      &lt;fragment
          android:id="@+id/fragment1"
          android:name="com.example.test.MyMapFragment"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>fragment_mymap.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity" &gt;
      &lt;fragment
          android:id="@+id/google_map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          class="com.google.android.gms.maps.SupportMapFragment" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>MyMapFragment.java</strong></p>
  
  <pre><code>public class MyMapFragment extends Fragment implements OnMapReadyCallback
  {
      private GoogleMap mMap;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View v = inflater.inflate(R.layout.fragment_mymap, container, false);
  
          SupportMapFragment mapFragment = (SupportMapFragment) getFragmentManager().findFragmentById(R.id.google_map);
          mapFragment.getMapAsync(this);
  
          // Inflate the layout for this fragment
          return v;
      }
  
      @Override
      public void onMapReady(GoogleMap googleMap) {
          mMap = googleMap;
      }
  }
  </code></pre>
  
  <p>Yet, I get error of <code>android.view.InflateException: Binary XML file line #8: Error inflating class fragment</code>.</p>
  
  <p>I have tried using <code>MapView</code> in fragment as like in <a href="https://stackoverflow.com/questions/26174527/android-mapview-in-fragment">this post</a>, or <a href="https://stackoverflow.com/questions/20919048/android-android-view-inflateexception-binary-xml-file-line-8-error-inflatin">this one</a>. But the thing is, <code>mapView.getMap()</code> is now deprecated. Though the program threw no error, the map is displayed but it's blank (Just showing Google logo on bottom left corner).</p>
  
  <p>Any suggestion is appreciated.</p>