I have a question, maybe it's silly but I've been trying several ways and nothing else I can not. I want to use the variable lo in the send method to another activity
but it does not leave me, it is assumed that in onLocationChanged
after all the procedure the variable is stored in the string value of the distance calculation and that value I need to send it to another layout, but this is not the case, in fact when trying to write the variable in the i.putExtra
it does not appear. I leave an image to see if it is more understandable.
@Override
public void onLocationChanged(Location loc ) {
Double lati = loc.getLatitude();
Double loni = loc.getLongitude();
double d = Double.parseDouble(ubica);
double distance = SphericalUtil.computeDistanceBetween(new LatLng(loni,lati), new LatLng(d,d));
String lo = Double.toString(distance);
}
@Override
public void onInfoWindowClick(Marker marker) {
Toast.makeText(this, "Información Detallada",
Toast.LENGTH_LONG).show();
// num1(marker.getSnippet());
for (MarkerInfo markerInfo : list) {
if (marker.getTitle().contentEquals(markerInfo.name)) {
String Abc;
Abc = marker.getTitle();
Intent i = new Intent(this, detalle.class);
i.putExtra("firstName", Abc);
i.putExtra("lastName", markerInfo.population);
i.putExtra("img", markerInfo.imageURL);
i.putExtra("website",markerInfo.web);
i.putExtra("ubica",markerInfo.ubica);
i.putExtra("distan", lo );
startActivity(i);
break;