I'm developing an application that shows a path on a map, determined by a KML file. Specifically, in the MapActivity that is starting the map:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
Uri uri = Uri.parse("geo:0,0?q=http://urltokml");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, uri);
mapIntent.setData(uri);
startActivity(Intent.createChooser(mapIntent, kmlFile));
finish();
}
The map loads fine and after a few seconds the path described by the KML shows up. The problem is, when I press the "Back" button, it does not return to the previous screen but instead just hides the KML overlay. If the "Back" button is pressed again, it will return to the previous screen.
Any ideas of how to solve this?