Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To animate the map towards the given geopoint, use animateTo() method,</p> <p>So implement a zoomListener in your method, and add the line,</p> <pre><code>mapController.animateTo(geoPoint); </code></pre> <p>also, try <code>mapview.invalidate()</code></p> <p>And btw, if you don't know to implement zoom listener, refer <a href="https://stackoverflow.com/questions/4729255/how-to-implemennt-onzoomlistener-on-mapview">How to implemennt OnZoomListener on MapView</a>.</p> <p>for the second question, you have used only <code>NETWORK_PROVIDER</code> which is less accurate than using GPS to get location values. So try using <code>GPS_PROVIDER</code>.An efficient and correct implemention could get you more accurate values.</p> <p>And to get latitude and longitude of the spot touched on the map, in the <code>mapOverlay</code> class implement a <code>onTouchEvent</code></p> <pre><code> @Override public boolean onTouchEvent(MotionEvent event, MapView mapView) { //---when user lifts his finger--- if (event.getAction() == 1) { GeoPoint p = mapView.getProjection().fromPixels( (int) event.getX(), (int) event.getY()); Toast.makeText(getBaseContext(), p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 , Toast.LENGTH_SHORT).show(); } return false; } </code></pre> <p>you can get the address from latitude and longitude by using <code>GeoCoder</code></p> <pre><code>Geocoder geoCoder = new Geocoder( getBaseContext(), Locale.getDefault()); try { List&lt;Address&gt; addresses = geoCoder.getFromLocation(latitude/1E6, longitude / 1E6, 1); String add = ""; if (addresses.size() &gt; 0) { for (int i=0; i&lt;addresses.get(0).getMaxAddressLineIndex(); i++) add += addresses.get(0).getAddressLine(i) + "\n"; } Toast.makeText(getBaseContext(), add, Toast.LENGTH_SHORT).show(); }catch (IOException e) { e.printStackTrace(); } </code></pre> <p>If you want to add marker to that point, add <code>overlayItem</code> for that point and add it to the overlay.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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