title: Google Maps v2 loading in a Fragment
body: <p>I have a tab and I would like load a map in a fragment of this tab, but I have some errors that I can´t solve.</p>
  
  <p>this is in my </p>
  
  <pre><code>MainActivity extends FragmentActivity
  
   private void initViewPager() {
  //      SupportMapFragment mMapFragment;
  //      mMapFragment = ((SupportMapFragment) getSupportFragmentManager()
  //              .findFragmentById());
          // 0. creamos una lista de fragment (vistas)
          List&lt;Fragment&gt; fragments = new ArrayList&lt;Fragment&gt;();
          //fragments.add(new TabChat());
          fragments.add(new TabMapa());
          //fragments.add(new TabInformacion());
  
          // 1. iniciamos el viewpager
          this.mViewPager = (ViewPager) findViewById(R.id.viewpager);
  
          // 2. creamos el adapter, que tambien implementara onPageChangeListener
          PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager(),
                  fragments);
  
          // 3. suscribimos adapter y listener del viewpager
          this.mViewPager.setAdapter(adapter);
          this.mViewPager.setOnPageChangeListener(adapter);
      }
  </code></pre>
  
  <p>TabMapa</p>
  
  <pre><code>public class TabMapa extends Fragment {
  private GoogleMap gmap;
  
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.tab_mapa);
      initGMap();
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      View myFragmentView = inflater.inflate(R.layout.tab_mapa,
              container, false);
      initGMap();
      return myFragmentView;
  }
  private void initGMap() {
      // obtenemos el mapa desde el fragment
      gmap = ((SupportMapFragment) getSupportFragmentManager()
              .findFragmentById(R.id.gmap)).getMap();
  }
    }
  </code></pre>
  
  <p>xml file</p>
  
  <pre><code>&lt;LinearLayout 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"
      android:orientation="vertical"
      tools:context=".Mapa" &gt;
  
      &lt;fragment
          android:id="@+id/gmap"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          class="com.google.android.gms.maps.SupportMapFragment" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>