I have the following situation with my Android application:
Any time I open up a new activity with a MapView, runOnFirstFix() will execute and my location will be shown on the map. This is good. I have another situation, however, when I will search for an address on another activity. The search will then open up a new instance of the MapView activity, and runOnFirstFix() will run, immediately following with onLocationChanged() which will query the searched location.
Usually, this works fine. There are some times when the onLoationChanged() will run BEFORE the runOnFirstFix(), and the result will show my location instead of the searched location.
It seems like there are two threads competing with each other. Does anyone have any recommendations on how to handle this?
Thanks!
Persist some state in the Activity’s intent’s extras to indicate to yourself what you’re trying to do. Check that state on your callbacks to make sure you’re doing the right thing.