Calculate bearing angle between two locations based on user direction
<p>I am using below method to find angle between my current location and destination location.</p>

<pre><code>public  float calculateBearing(Location before, Location after) {
     Point pBefore = location2Point(before);
         Point pAfter = location2Point(after);
float res = -(float) (Math.atan2(pAfter.y - pBefore.y,pAfter.x-pBefore.x)*180/ Math.PI) + 90.0f;
          if (res &lt; 0)
      {
          Log.e("angle ",""+(res + 360.0f));
              return res + 360.0f;
      }
      else
      {
          Log.e("angle ",""+res);
              return res;
      }
    }
</code></pre>

<p>But this give angle from user current location always towards north.But if the user turns to South or East also i need to calculate the angle based on user bearing.</p>

<p>I know using Sensor Manager its possible to calculate bearing angle.But how can i calculate bearing to destination location from user current location.</p>

<p>Thanks In Advance</p>
