compute distance works
authorEugene Crosser <Eugene.Crosser@ru.ibm.com>
Thu, 2 Feb 2012 14:13:11 +0000 (18:13 +0400)
committerEugene Crosser <Eugene.Crosser@ru.ibm.com>
Thu, 2 Feb 2012 14:13:11 +0000 (18:13 +0400)
src/org/average/whereami/LastLocation.java

index 914a615217ddec08903f1f33dbc390bf5d8f8fd4..b710e169f59bff77562076496d5dcdea5d0a3d20 100644 (file)
@@ -36,7 +36,7 @@ public final class LastLocation extends Oracle {
                loc_names = res.getStringArray(R.array.loc_names);
                loc_lats = res.getStringArray(R.array.loc_lats);
                loc_lons = res.getStringArray(R.array.loc_lons);
-               loc_lons = res.getStringArray(R.array.loc_dists);
+               loc_dists = res.getStringArray(R.array.loc_dists);
 
                HttpTransport transport = AndroidHttp.newCompatibleTransport();
                JsonFactory jsonFactory = new JacksonFactory();
@@ -103,11 +103,11 @@ public final class LastLocation extends Oracle {
                                        Double.parseDouble(loc_lons[i]));
                        Log.v(TAG, "Dist from " + loc_names[i] +
                                " is " + dist);
-                       //if ((loc_dists[i] == "0") ||
-                       //    (dist < Double.parseDouble(loc_dists[i]))) {
-                       //      locmsg = loc_names[i];
-                       //      break;
-                       //}
+                       if ((loc_dists[i] == "0") ||
+                           (dist < Double.parseDouble(loc_dists[i]))) {
+                               locmsg = loc_names[i];
+                               break;
+                       }
                }
                return locmsg;
        }