I'm done creating an android program that adds a marker to a location. But I need to show CURRENT MY LOCATION in the MAP. I know this is done thru location based services but I don't know how to incorporate it into my program
Here is my onCreate command
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//map
mapView = (MapView) findViewById(R.id.mapView);
//zoom
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
//Philippines coordinate
mc = mapView.getController();
String coordinates[] = {"10.952566007", "121.78921587"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(6);
mapOverlay = new MapOverlay();
listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);
mapView.invalidate();
}
I have an onTouchEvent that places the marker. So no problem there, the problem is I need to display my location at the start of the program. It should show a mark that says, "You are here" or something like that in the map.
p.s: I think I need to change the hardcoded point to my current location point, but i don't know how to do that :|