I'm using GoogleMaps in my Android app, and I want to display an animated radar image on the map.
I have an array of 6 Bitmaps. When the user hits play, the map loops through displaying each of those images on the map.
This is working, but when transitioning between the images, if I don't call GoogleMap.clear(), the images just get continually stacked on top of each other.
If I do call GoogleMap.clear(), I get a horrible blink. I want one image to remain on the map until the next one is displayed.
Is there a good way to do this?
Is there maybe a double-buffering option for GoogleMaps?
Oh, actually, what I ended up doing was extending the GoogleMap class and overriding the onDraw function to my liking.
Related
I'm struggling to find a solution to the following problem in Android:
there should be custom views on the map which should animate/expand/etc just like regular views. For instance I need a current user location indicator which "pulsates" on the map, or I need some kind of marker clustering with the following behavior: when I tap on the cluster all the pois from this cluster are animated out evenly spread around the cluster so you can click them individually.
I've seen solutions involving periodically drawing into bitmap canvas and then updating the marker's bitmap, but it doesn't help when you want to click on the expanded items in the bitmap, also animating a marker with updating it's bitmap would look horrible and clunky.
On iOS for example there is a class MKAnnotationView which you can override and draw however you want, why doesn't android have such a simple feature? How can this be achieved in Android? Any help is appreciated.
i am doing an android app, that is displaying markers on google map. The problem here is i need to handle ~10k markers. I can't do clustering as every marker is important and i can't show this markers from some zoom level as it is important to get the 'bigger picture'
WHAT I'VE TRIED:
displaying only visible markers, but they are too dense and still I am left with few thousands and map just can't handle it..
I moved away from google markers and created surfaceview over map fragment. And this works fine when I update my 'markers' after google map camera changes (after u stop dragging it), but this looks bad, because in between updates they are anchored to its position on screen not on map. And when i try to update my surfaceview while dragging it is not doing too well and freezes.
QUESTIONS:
will moving from surfaceview to opengl improve rendering time?
any other ideas?
EDIT:
firstly i will clarify, important is not every single marker, but the shape of the cloud of markers.
And also I've already tried heatmaps from google maps extension, but it kept freezing while dragging the map, heap kept growing until it finally breaks.
Rendering markers in google map is very resource expensive task. If the marker is custom designed it will take more time to just to create the bitmap.Traditional way of creating marker will not help here, bcz rendering is done by Main Thread. You have to implement some parallel processing to create the markers, So redering markers will not disturb your main thread. You can implement something like this
http://leaks.wanari.com/2016/05/05/rendering-markers-for-android/
I hope it will help you. Good Luck.
I want to code a map application in Android(MinSDK=2.1).
But this map will not use any online features.It will be completely offline.
Also this map shows a high definition image which is drawn by me.I must specify points (like buildings,parkings,cafes...etc) and place little Imageviews on these points.
When needed , screen must move any requested point.
So Is there any sdk,library...etc to do this you know ? Or Should I implement myself.Lead the way pls.Thanks for any help...
i have a map view using google map API
in my map i have few overlays markers which i've designed throw extending the ItemizedOverlay.
i want to change this markers drawable image after the map is already visible to user.
is it possible ?
my intention is to run some lazy drawable loading (like you do in a list view), because all my images are coming from the web, and i don't want the user to wait for all the images to load before i load the map.
on a list view its kind of easy, because the thread will update the ImageView, but here i don't know how to access a specific item after the map has loaded..
thanks!
Check out the function setMarker in OverlayItem. It will let you change the image for a specific marker. Just make sure you centerBound the image before setting it.
OverLayItem
According to me first load all the dummy iamges and show it on the mapview and simultaniously start a background task to download all the images from server and once the image downloads process completes just clear all the overlays on the mapview and reload the actually downloaded images on the mapview.
I have faced some problems with the Android MapView API. I get OverlayItems from a database which I want to display in a MapView. If I'm displaying 100 Icons, I have no issues, but if it gets more - like 500 Items in one City - it first looks really bad, while second it slows down a lot. Unfortunately my goal is to display 10000 of them. I think one solution can be to register a listener to ZoomLevels to make them appear/dissapear, but I couldn't find that functionality. Second, I couldn't find a function to scale my Overlays with the Zoom of the Map.
Any Ideas are very welcome
There is a very strange behavior in ItemizedOverlay draw method. When you say: Draw line from (x,y) to (x1,y1) the draw method is called about 20-30-40 times - i don't know why. It is acceptable when you draw one line, but when you draw a thousands of lines,icons and so on...it is very very bad! To solve this problem you should create a cached overlay. This is overlay that catches the first draw, creates the object and then prevents the future draws that do the same draw.
A cluster is a dozen of icons behind one icon. For example if you have 1000 markers on the map, in a specific minimal zoom level you can not see each marker separately - it becomes a mess of icons and colors and so on. And instead of 100 markers that are very very close one by one you place a cluster marker. And on zoom in remove this cluster and create another clusters...do this until the markers became far enough away and you can seen them divided.
Check this: Cluster markers
Take the following approaches:
Create a cached overlay to prevent multiple drawing of same clusters;
Draw in thread;
Cluster your markers depending on zoom level and marker proximity.
Each time you draw in the overlay, check for sure is the current marker inside of the visible part of the screen. If it is not, do no draw it!
I had a similar problem with the icon size and zoom level in my application. What I ended up doing was having 2 sets of overlays containing the markers, one with a "zoomed in" icon and one with a "zoomed out" icon. Then just changed the overlay at a certain zoom level (using a zoom poller - On zoom event for google maps on android)