Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Location.distanceBetween throw an Exception for the result parameter?

Why doesLocation.distanceBetween throw an Exception with the following example:

Location.distanceBetween(51.5175431381974,-0.1501073187713473, 51.5173695544231, -0.15127676190184, results);

I checked same positioning here and the distance was reported as 0.08319 km and I'm not sure why it throws the Exception:

java.lang.IllegalArgumentException: results is null or has length < 1
like image 682
AndroidGecko Avatar asked Jan 04 '12 18:01

AndroidGecko


1 Answers

your results variable needs to be initalized to an array of floats with length > 0. The spots in this array are filled with the result of the calculation.

like image 96
elijah Avatar answered Nov 16 '22 12:11

elijah