how do I remove an overlay?

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

how do I remove an overlay?

Postby don » Thu Mar 20, 2008 9:42 pm

I have a map overlay that I want to remove and show a different overlay. I have tried to deactivate the first, however I keep ending up with both overlays showing simultaneously. Does anyone know how to remove or hide an overlay in order show another? Both overlays consist of several shapes, though not the same number, so just changing the coordinates won't work.

Thanks for any help in advance.
don
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Dec 07, 2007 5:17 am

Top

Postby bluefloyd8 » Fri Mar 21, 2008 3:38 am

Try using overlayController.getOverlays() to get a list of the overlays. Then deactivate.

Perhaps the getOverlays() returns a pointer to the overlay being used which would make deactivate() work.

Let me know how it goes.
User avatar
bluefloyd8
Experienced Developer
Experienced Developer
 
Posts: 70
Joined: Tue Jan 22, 2008 3:57 am
Location: Indiana, USA

Postby don » Fri Mar 21, 2008 4:52 am

Thanks for the response.

I tried this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.     private List<Overlay> overlays;
  3.  
  4.     int shapeOneIndex;
  5.  
  6.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

snip
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.     overlays=myOverlayCtlr.getOverlays();
  3.  
  4.     myOverlayCtlr.deactivate((Overlay)overlays.get(shapeOneIndex));
  5.  
  6.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Where shapeOneIndex is set when the shapeOne overlay is added to the overlay controller.

However, this doesn't work, I get the same result. Did you mean to iterate through the overlays until I get to the one I want, rather than referring to it by its ordinal number?

Thanks again for the help.
don
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Dec 07, 2007 5:17 am

Postby bluefloyd8 » Fri Mar 21, 2008 5:57 am

hmm...
What you tried is what I was thinking would work. Does calling the deactivate all function clear the overlay? I realize that is not what you want to do but it is a start to understanding the problem.

Ive been fooling around with overlays lately. If i find anything useful, i will post it here.

-danny
User avatar
bluefloyd8
Experienced Developer
Experienced Developer
 
Posts: 70
Joined: Tue Jan 22, 2008 3:57 am
Location: Indiana, USA

[resolved ... kinda]

Postby don » Fri Mar 21, 2008 3:46 pm

I have found a rather inelegant solution. First clear all of the overlays with overlayController.clear, then re-add all of the overlays and activate them. This isn't a very good solution if you only want to change one overlay and leave the remaining ones the same. You will still have to reload all of them.

I anyone has a better solution, please post. I don't have too many overlays so it isn't too bad of a speed hit, but if someone had a lot of them, it could add up.

Thanks again for your help bluefloyd8.
don
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Dec 07, 2007 5:17 am

Top

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest