Note that there are some explanatory texts on larger screens.

plurals
  1. POget current location
    text
    copied!<p>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</p> <p>Here is my onCreate command <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);</p> <pre><code> //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(); } </code></pre> <p></pre></code></p> <p>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> <p>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 :| </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload