[android-developers] When are the overlays drawn on the map?

2010-07-17 Thread AUandroid
What I am trying to do - I am continuously getting a stream of lat/lng
positions, I want to move a overlay item dynamically on the map based
on the lat/lng in the stream. I am displaying the location of moving
object dynamically on the map

I am putting my whole code in a while(true) loop and trying to read
the stream every 5 seconds and refresh the overlays on the map. But
overlay items are not shown until the function (either oncreate, or
any onclickeventhandler etc) is completed. For example, test code,  I
am adding a single test overlay item when ever the user clicks on a
button. If I put a wait(200) after I add overlays and invalidate
the map, the overlay is not displayed until the time has elapsed and
the function is completed.

Any ideas or suggestions? please let me know if you want me to explain
the problem more


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


[android-developers] When are the overlays drawn on the map?

2010-07-17 Thread AUandroid
What I am trying to do - I am continuously getting a stream of lat/lng
positions, I want to move a overlay item dynamically on the map based
on the lat/lng in the stream. I am displaying the location of moving
object dynamically on the map

I am putting my whole code in a while(true) loop and trying to read
the stream every 5 seconds and refresh the overlays on the map. But
overlay items are not shown until the function (either oncreate, or
any onclickeventhandler etc) is completed. For example, test code,  I
am adding a single test overlay item when ever the user clicks on a
button. If I put a wait(200) after I add overlays and invalidate
the map, the overlay is not displayed until the time has elapsed and
the function is completed.

Any ideas or suggestions? please let me know if you want me to explain
the problem more

Thanks,
-vk

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


Re: [android-developers] When are the overlays drawn on the map?

2010-07-17 Thread Frank Weiss
If the updates don't happen until the onCreate or onClickEventHandler
methods return, first guess is you're misusing the UI thread. That is,
the UI thread is busy in your while loop and can't get anything else
done, like drawing the overlays. Welcome to UI programming!

I strongly suggest you put you loop into an AsyncTask. and use its
callback methods to update the UI. Read the docs carefully.

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