Using the distanceTo method
<p>My code should accept locations that has accuracy under 100, if the new location accuracy is <strong>smaller</strong> then the old more in 20 then use the new one.
Also if the distance from the new location to the old one is larger then 200 use it.</p>

<p>I have no idea why but after testing my code I got the following locations in my db:</p>

<p><img src="http://i.stack.imgur.com/PXfAH.png" alt="enter image description here"></p>

<p>The last 3 records are less then 200m from each other, how come I use them??
Here is the code:</p>

<pre><code>int Aloc = (int) loc.getAccuracy();
int AnewLoc = (int) newLoc.getAccuracy();
if(Aloc &gt; AnewLoc +20)
    sendTask();
else
{
    float distance = loc.distanceTo(newLoc);
    if(distance &gt; 200)
        sendTask();
}
</code></pre>

<p>This code is executed to locations that their accuracy is less then 100.</p>

<p><strong>EDIT</strong>
after changing the condition to</p>

<pre><code>if((AnewLoc+20) &lt; Aloc)
</code></pre>

<p>I received the following records:
<img src="http://i.stack.imgur.com/p02E0.png" alt="enter image description here"></p>

<p>The new records has larger accuracy then the old one and his distance is less then 200(0.01407 km which is 14 meters). I can't understand how come it pass by the code and sent to the db.</p>
