You can use com.google.android.maps.MyLocationOverlay which will automatically get show your location on your map view. It will even update your location when travelling.
Note: you show call enableMyLocation and disableMyLocation on onResume and onPause respectively for better performance.
@Override
protected void onResume() {
super.onResume();
if (locationOverlay != null)
locationOverlay.enableMyLocation();
}
@Override
protected void onPause() {
if (locationOverlay != null)
locationOverlay.disableMyLocation();
super.onPause();
}
EDITED
MyLocationOverlay locationOverlay;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapView);
mapView.setTraffic(true);
mapView.setBuiltInZoomControls(true);
locationOverlay = new MyLocationOverlay(this, mapView);
List<Overlay> mapOverlays = mapView.getOverlays();
mapOverlays.add(locationOverlay);
}
also add the onResume() and onPause() methods.