title: Refresh/Reload google maps API v2
body: <p>In my android application, I'm using Google Maps API v2 and navigation drawer to access various categories like culture, gastronomy,...</p>
  
  <p>By default, the map loading all items but if I select a category, I would like the map is upgraded.</p>
  
  <p>I've tried to call a method of fragment from my mainactivity but I create the fragment dinamically and I cant access to the "findFragmentById". This is my code:</p>
  
  <p><strong>MapaFragment.java (Map fragment)</strong></p>
  
  <pre><code> public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
          if (container != null) {
              container.removeAllViews();
          }
  
          rootView = inflater.inflate(R.layout.fragment_mapa, container, false);
          listaLugares = ((ListaLugares)getActivity().getApplicationContext());
  
          // obtengo el mapa       
          mapa = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
  
          // Move the camera instantly to my position with a zoom of 15.
          LatLng miPosicion = new LatLng(main.obtLatitud, main.obtLongitud);
          mapa.moveCamera(CameraUpdateFactory.newLatLngZoom(miPosicion , 14) );
  
          // Zoom in, animating the camera.
          mapa.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null);
  
          // Add marker to the map
          addItemsToMap();
  
  
          return rootView;
  
      }
  
      public void addItemsToMap() {
          mapa.clear();
          if (listaLugares.lista.isEmpty()) {
              listaLugares.readPlaces(5000, 0, listaLugares.idCategoria);
          }
  
          LatLng miPosicion = new LatLng(main.obtLatitud, main.obtLongitud);
          mapa.addMarker(new MarkerOptions()
              .position(miPosicion)
              .title("Mi posición")
              .icon(BitmapDescriptorFactory.fromResource(R.drawable.location_icon)));
  
          for (int i = 0; i &lt; listaLugares.lista.size(); i++) {
  
              LatLng posItem = new LatLng(listaLugares.lista.get(i).latitud,listaLugares.lista.get(i).longitud);
  
              mapa.addMarker(new MarkerOptions()
                  .position(posItem)
                  .title(listaLugares.lista.get(i).nombre)
                  .snippet(listaLugares.lista.get(i).descripcion)
                  .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));
              Log.v("MAPA", "Marker " + i + ": " + listaLugares.lista.get(i).nombre);
          }
      }
  </code></pre>
  
  <p><strong>fragment_mapa.xml (layout of fragment that contain a map)</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/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>Note:</strong> In <strong>MainActivity.java</strong>, I create the navigation drawer and when I select an item, it should refresh the map.</p>