Android Maps Back Button

Posted by aaronr on Stack Overflow See other posts from Stack Overflow or by aaronr
Published on 2010-06-16T19:52:24Z Indexed on 2010/06/16 19:52 UTC
Read the original article Hit count: 476

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about android