title: Bearing doesn't shift immediately in map
body: <p>I am developing an app which implements google map.I calculate bearing using the code below.When i am moving in one direction and if i change the direction suddenly the bearing doesn't shift immediately which defeats the purpose of my app.Here is the code which calculates the bearing</p>
  
  <pre><code>protected static double bearing(double lat1, double lon1, double lat2, double lon2){
  
      double longDiff= Math.toRadians(lon2-lon1);
      double y = Math.sin(longDiff)*Math.cos(Math.toRadians(lat2));
      double x = Math.cos(Math.toRadians(lat1))*Math.sin(Math.toRadians(lat2))-Math.sin(Math.toRadians(lat1))*Math.cos(Math.toRadians(lat2))*Math.cos(longDiff);
      return ( Math.toDegrees(Math.atan2(y, x)) + 360 ) % 360;
  }
  </code></pre>