Joined June 2014
·

iostreamer

Android Application Developer
·
127.0.0.1
·
·
·

true that, I used this only because I was already doing file handling. If file handling isn't involved in one's app then this thing is pretty much useless

Distance:
Now that you have directionPoint(A List of LatLngs(see code)), you can use Location class, instantiate a variable of that class, supply latitude longitude information from directionPoint while traversing it, and lastly use the Location.distanceTo(Location) to get distance between each LatLng in directionPoint, add em up and you will have the total distance .

Time:
Using GPS:
Read this to get current speed via GPS http://www.androidhub4you.com/2013/06/how-to-get-device-current-speed-in_112.html
time=distance/speed.
And most imprtantly, don't forget to update the distance with respect to current location.
Without using GPS:
Use the accelerometer to get current acceleration of device, use the formula: v=u+at
where v=final velocity
u=initial velocity
a=acceleration
t=time for which the acceleration was achieved
now that you have a and t, initially put u=0, then at the end f each iteration put u=v
now, time=distance/speed, you have distance, you got speed, and now you got time too.

Achievements
54 Karma
6,512 Total ProTip Views
Interests & Skills