Why does Location.distanceBetween raise an exception for the result parameter?

Why Location.distanceBetween throws an exception in the following example:

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

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

 java.lang.IllegalArgumentException: results is null or has length < 1 
+4
source share
1 answer

your result variable must be initialized with a floating-point array of length> 0. The items in this array are populated with the result of the calculation.

+10
source

Source: https://habr.com/ru/post/1389333/


All Articles