Thanks you your reply. I have no problems on filtering locations. I'm juste wondering what's the best way of doing it. If I do some filtering in the SQL query, I will have to query a lot of times as user location change. On the contrary, If the contentProvider returns the whole list without filtering, I will have unnecessary data, but only one query. If I do some SQL query filtering, how do I pass longitude and latitude ? Does content://.../longitude/latitude isn't a bit weird ? Thanks Guillaume
On Nov 24, 10:33 pm, Kostya Vasilyev <kmans...@gmail.com> wrote: > ContentProvider doesn't have anything to do with locations. > > It's an abstraction for data access with some useful functionality (like > cross-application data access, data change notifications, etc.). > > You could implement your own, and it could be useful if you wanted to > access your data from multiple activities. But it's not necessary, > strictly speaking - unless you wanted to expose this data to other > applications in a definedway. > > Now as for location filtering - I'd try and do some rough filteringrightin > the SQL query (perhaps based on a "box" aligned along the > latitude / longitude grid), then perform fine filtering based on actual > distance calculations (a circle centered on current position) on that data. > > For computing the distance (for fine filtering) you could use this: > > http://developer.android.com/reference/android/location/Location.html..., > double, double, double, float[]) > > -- Kostya > > 24.11.2010 20:01, Guillaume пишет: > > > Hi all, > > I need some help on how to show nearest locations, therightway. > > I have in my DB a list of locations. I want to show the n nearest > > locations (n choosen by the user) with some filters (show only > > favorites, show only open etc...). > > I think I should create a ContentProvider, but where do I do the > > filtering ? Does the contentProvider has to send only the wanted > > locations, or should he return the whole list, and so the mapView > > should filtering locations by itself ? > > Thanks for your help, > > Guillaume > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget > --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en