I was able to "refresh" the items on my map by calling the activity
again

I "bound" an intent onto a button (tab in my case) and when clicked,
it does startActivity(intent) which forces map to reload its overlay
(or whatever you decide to put into onStart() )

Possibly not the most efficient method, but it works well

Have a read of my findings :
http://www.jameselsey.co.uk/blogs/techblog/android-using-intents-to-refresh-tab-content/

On Sep 26, 3:11 pm, cwgrc2 <[email protected]> wrote:
> I have built a simple app that uses a Google MapActivity.  On top of
> the Map, I have 2 overlays, a Marathon Course and the position of a
> runner.  The latter position overlay simply shows an updated blue
> dot.  I update the location of the dot every second but the screen
> does not refresh.  If I tap the scrren then the dot updates.
>
> Am I missing some hard refresh call somewhere?  My Overlay code is
> small and shown below.  Note that it does go into the draw routine
> every second and the point is changed.
>
> Thanks,
>
> Chris
>
> public class GhostOverlay extends ItemizedOverlay<OverlayItem> {
>
>   private OverlayItem _ghost = new
> OverlayItem(getPoint(39.55122004263103,
>                         -105.13980455696583), "Ghost", "Start of
> ride");
>
>   public GhostOverlay(Drawable arg0) {
>     super(arg0);
>     populate();
>   }
>
>   private GeoPoint getPoint(double lat, double lon) {
>     return(new GeoPoint((int)(lat*1000000.0), (int)(lon*1000000.0)));
>   }
>
>   protected OverlayItem createItem(int i) {
>     return _ghost;
>   }
>
>   public int size() {
>     return 1;
>   }
>
>   @Override
>   public void draw(Canvas canvas, MapView mv, boolean shadow) {
>     super.draw(canvas, mv, shadow);
>   }
>
>   /**
>    * Update the location of the ghost runner, called every second.
>    * Is there a refresh I need to call?  The screen only updates when
> I
>    * tap it or switch a tab and come back.
>    * @param loc the 2D location of the runner.
>    */
>   public void drawGhost(Coord2D loc) {
>     _ghost = new OverlayItem(getPoint(loc.y, loc.x), "Ghost", "");
>     populate();
>   }
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to