Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Location l1 = new Location("One");
- l1.setLatitude(cur_latitude);
- l1.setLongitude(cur_longitude);
- for (int i = 0; i < lctn.size(); i++) {
- Location l2 = new Location("LocationB");
- l2.setLatitude(lctn.get(i).getLocation_lat());
- l2.setLongitude(lctn.get(i).getLocation_lng());
- float distance = l1.distanceTo(l2);
- distance =Float.parseFloat(new DecimalFormat("##.####").format( distance / 1000.0f));
- Double mile = Double.parseDouble(new DecimalFormat("##.####").format(distance * 0.6214));
- Log.e("km_", "" + distance);
- Log.e("miles_", "" + mile);
- int accuracy = 20;
- if(l2.getAccuracy() <= accuracy ) {
- Log.e("km_", "" + distance);
- Log.e("miles_", "" + mile);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement