Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load markers dynamically for current position in Android google-maps?

I'm currently developing an app for Android which uses google map service. Because users will be able to see thousands of markers I would like to load only those which are currently within the map bounds (i.e. when user look at specific map tile). I know how to do it with javascript/html. However, Android doesn't seem to provide any similar methods such as containsLatLng(latlng) or getBounds (I only found getLatitudeSpan and getLongitudeSpan, but don't know how can I use them in order to achieve the similar effect).

Can anyone give me some hint on that? I would greatly appreciate any help or at least pointing myself in the right direction.

like image 965
Pavel Avatar asked Aug 05 '10 09:08

Pavel


1 Answers

You could use getMapCenter and just add or subtract the latitude span or longitude span (divided by 2 of course) to find the bounds.

like image 193
LordTwaroog Avatar answered Sep 25 '22 18:09

LordTwaroog