01-16-2013 03:15 AM
i want to create a listview that sorted by nearest location from my phone using geolocation
i already create a list and has a longitude and latitide inside them, but i dont know how to sort it from nearest place from me
can someone give me idea how to do this on blackberry java ?
any idea or suggestion are very usefull to me
thanks in advance
01-16-2013 04:43 AM
You say 'ListView' - are you developing in QML and BB 10. There is no ListView in BBOS but there is in BB10.
However both BBOS and BB10 'co-ordinate' class have a distance function that will provide you with the distance from one coordinate to another. So in both you can calculate how far away from a point a location you have actually is. Then you can just sort using this value.
Look at the API documentation in both cases to find out how to do this.
Regarding sorting, in addition to just coding your own, in BB Java there are various Sorted collections - just follow the API documention for the classes that implement SortableCollection. And there is the SimpleSortingVector.