android google map changeing on the run - android

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.

Related

Android google maps tile overlay update on zoom

I have a tile overlay in Android Google Map. Everything works fine. But when I zoom in, all tiles disappear then new tiles are downloaded and only after 1-2 secs(when new tiles are downloaded) the map shows them. Therefore, the map doesn't show tiles for some time. Is there a way to update tiles only when new tiles are downloaded?
I use a basic UrlTileProvider and Aeris Overlay maps.
Anyway, you can download each tile as image to local internal or external storage with, for example, Picasso library (or separate Thread or AsyncTask) and determine "all new tiles are downloaded" event "manually" (e.g. increment downloaded tiles counter on every public void onSuccess() for Picasso or protected void onPostExecute() for AsyncTask or on end of public void run() for Thread and wait that equals all tiles quantity) then use TileProvider for downloaded tiles local storage like in this answer of Alex Vasilkov.
Update
For showing previous map when tiles for zoom+1 level still downloading it's possible to create GroundOverlay with screenshot of current map view. Screenshot of google map you can do like in answers for this question of DiscDev
Update #2
There are several ways to solve you problem: 1) you can create custom view which extends MapView class like in this answer and show in overridendispatchDraw() method whatever you want or 2) you can set ImageView over your MapView and show it with screenshot on it while zoom changed and new tiles loaded. And if necessary you can translate tap events from ImageView to MapView and so on.
I prefer p.1 - create MapView-based custom view, override dispatchDraw() and show temporary map within it while new map loading.

Loading osmdroid MapView in a new thread

Loading of the map in my application was slow on some devices. I wanted to load the map in a different thread and show a progress dialog until it is done.
I found this article: http://pygmalion.nitri.de/android-starting-an-activity-containing-a-mapview-takes-forever-380.html
I think that the only thing it does is waiting for defined time and then run the code inside the run() method. That's not what I want.
I tried to use ASyncTask with the same XML layout as in the article above:
in doInBackground()
created MapView by new MapView(MyActivity.this);
setters for multitouch, zoom controls, tilesource (offline with osmbonusback)
in onPostExecute()
added mapview to the prepared FrameLayout
The map loaded correctly but the zoom coontrols were on the top of the screen. Also when I zoomed in, the tiles got rescaled instead of loading the correct zoom level tiles - until I moved the map.
Is there any way to open the activity instantly, wait for the map and let the user know it is loading?

GoogleMaps GroundOverlay blinks my images

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.

Android Map has loaded fully

I have a requirement where in i need to take an image of mapview and use it for displaying in a pdf. I am able to take the image and display it in pdf but the only issue is when i am taking the snap of the MapView sometimes the map is not fully loded.
Is there any event which can notify me if the map is fully loaded or any other way to know if the map is loaded in android app.
So after too many days of findings what i end up with is that there is no 100 % guranteed way of finding it. There are few methods present thought one of them being:
canCoverCenter
public boolean canCoverCenter()
Checks whether we currently have a map tile to cover the center of the map.
Returns:
True if there is a tile for the center, false otherwise.
But it only notifies for the center tile and not all the tiles. :(

Indoor map in android

I am trying to create an indoor map like the below image.This is scrollable/moving in the whole screen.I am not getting what is a right approach to create it .Is this a Google Indoor Map ?
How can i create buttons over an image like this map ?
Please Suggest.
I would recommend using a standard image file / breaking your image into tiles, then making a custom View which loads your map image and captures all the touch events for scrolling and click detection.
If you want clickable overlays you could take two approaches:
Include the buttons in the source image and look for hotspots in the image when it is clicked.
Create a list of co-ordinates within your image to overlay a button graphic, when a click is detected you can compare the position of the click with this list (and a small margin for error).
Personally I prefer the second method and have used it successfully in several projects requiring maps with clickable points of interest.
I got the solution by creating an Imagemap using html and embedded that html in a WebView.

Categories

Resources