0

I have a ListView with multiple elements. When I click each element of a ListView it loads a Google Map inside FragmentActivity with routes I put before. But when I press back and click another element of the list, the map doesn't show any route and it says that I have Exceeded Max Waypoints. How Can I re instantiate in order to load a new map?

Here some code...

    GoogleMap mMap;

    try 
    {
        Route ruta = new Route();
        MapsInitializer.initialize(this);


        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(3.4274051,-76.521492), 12));

        for(int i = 0; i < estaciones.size(); i++)
        {
            mMap.addMarker(new MarkerOptions()
            .position(estaciones.get(i))
            .title(nombreEstaciones[i])
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.busstop)));
        }

        ruta.drawRoute(mMap, this, waypoints, "es", true);

     } catch (GooglePlayServicesNotAvailableException e) {
         e.printStackTrace();
     }
tony m
  • 4,769
  • 1
  • 21
  • 28
Brigadier
  • 886
  • 7
  • 17

0 Answers0