As from this page, distanceBetween() returns inaccurate result?
I'm trying to calculate the distance from a user location everytime the user ismoving. How to make this for
loop, if there is new results, add it to old result, then setText()
it.
I'm trying with ++
like this:
tvJarak.setText(results[0]++ + "");
but did not work.
for (int z = 0; z < listPoints.size(); z++) {
float[] results = new float[1];
Location.distanceBetween(latStart, longStart, latB, longB, results);
tvJarak.setText(results[0] + "");
}
i edit :
float[] results = new float[1000];
for (int z = 0; z < listPoints.size(); z++) {
Location.distanceBetween(latStart, longStart, latB, longB, results);
results[0]+=results[1];
}
tvJarak.setText(results[0] + "");
it gives weird number randomly. it should be ++