title: How can I reset the route in Google Maps from my Android App
body: <p>When a user of my Android Google Maps API V2 app selects a marker on the map I set a latlng called MOCK_LOCATION to the location of the marker.  When the user then clicks a certain button I show the route in Google Maps where the user can choose to follow the navigation if they wish to.  </p>
  
  <p>This all works wonderfully well...THE FIRST TIME.  When the user switches back to my app and chooses a different marker and then clicks the button again, the Google Maps app is displayed with the first route.  I have found if I manually remove the route in the Maps app, then the button works again.</p>
  
  <p>The obvious aim of this question is therefore: How can I clear the route before loading the app with the new destination/route again?</p>
  
  <p>All help much appreciated.</p>
  
  <p>See code below:</p>
  
  <pre><code>public void clickDrive(View view) {
      if (MOCK_LOCATION == null) {
          Toast.makeText(this, "Select a destination site first", Toast.LENGTH_SHORT).show();
          return;
      }
  
      String uri = "http://maps.google.com/maps?daddr="+MOCK_LOCATION.latitude+","+MOCK_LOCATION.longitude+" (" + MOCK_SITE + ")&amp;dirflg=d";  //d=driving, r=transport w=walking
      Intent driveRoute = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
  
      Log.i(LogTAG, uri);
      if (isAppInstalled("com.google.android.apps.maps")) {
          driveRoute.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
      }
      startActivity(driveRoute);
  }
  </code></pre>