Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess to a "GeoPoint" out of the method "run()"
    primarykey
    data
    text
    <p>I need to access the value "pt" of method "run ()" out of this method. How I can do it?. Here's the method:</p> <pre><code>public void minimaDistancia(final ItemizedOverlay itemized) { final MyLocationOverlay myloc = new MyLocationOverlay(this,mapa); myloc.enableMyLocation(); //Activamos actualización de la posición myloc.enableCompass(); //Activamos la brújula myloc.runOnFirstFix(new Runnable() { public void run() { GeoPoint pt = myloc.getMyLocation(); } }); ... } </code></pre> <p>Thanks.</p> <hr> <p>I need to access to the "min_dist" in this method:</p> <pre><code>public void processLocation(GeoPoint punto,ItemizedOverlay itemized) { double min_dist = 1000; double dist_aux; int i; Location puntoA = new Location("Punto 1"); puntoA.setLatitude(punto.getLatitudeE6()); puntoA.setLongitude(punto.getLongitudeE6()); for(i=0;i&lt;12;i++) { Location puntoB = new Location("Punto 2"); puntoB.setLatitude(itemized.getItem(i).getPoint().getLatitudeE6()/1E6); puntoB.setLongitude(itemized.getItem(i).getPoint().getLongitudeE6()/1E6); dist_aux = puntoA.distanceTo(puntoB)/1000; dist_aux = (double)Math.round(dist_aux*100)/100; if(dist_aux &lt; min_dist) min_dist = dist_aux; } minimun_distance = min_dist; } </code></pre> <p>I want to get the minimun distance between my location and the nearest hospital (is a first aid application). I've tried to declare a global variable like this: public static double minimun_distance, but when I want to change it's value, simply doesn't do it. It doesn't change the minumun_distance value in the assignment. I forgot to say that when I try to show a Toast in this method, the app crashes whit a RunTimeError (I see it in the Eclipse Debugger).</p> <p>Thanks for the answers.</p>
    singulars
    1. This table or related slice is empty.
    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