title: How to calculate difference between longitude latitude?
body: <p>I need to calculate the difference between longitude and latitude of current position<br>
  and previous position. but it display the result in Exponential format and I need it in<br>
  metres. I don't understand how to convert it in metre format. 
  Which formula require for that?  </p>
  
  <pre><code>double distance2 = distanceCalculate(lat,lng,locationB.getLatitude(),locationB.getLongitude());
  Toast.makeText(this, "distance2=="+Double.valueOf(distance2).longValue() + "meter" , Toast.LENGTH_SHORT).show(); 
  
  double ActualDistance=(Double.valueOf(distance2).longValue())/1E6;
  if(ActualDistance&lt;400)
  {
      System.out.println("identical");
      Toast.makeText(this,"identical", Toast.LENGTH_LONG).show();
  }
  else
  {
      // send sms
      SmsManager sms = SmsManager.getDefault();
  }
  
  public static float distanceCalculate (double lat1, double lng1, double lat2, double lng2 ) 
  {
        double earthRadius = 3958.75;
        double dLat = Math.toRadians(lat2-lat1);
        double dLng = Math.toRadians(lng2-lng1);
        double a = Math.sin(dLat/2) * Math.sin(dLat/2) +
        Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
        Math.sin(dLng/2) * Math.sin(dLng/2);
        double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
        double dist = earthRadius * c;
  
        int meterConversion = 1609;
  
        return new Float(dist * meterConversion).floatValue();
  }
  </code></pre>