In my app i have a TabActivity which contains two tabs, the first one is a MapActivity and another one is a ListView.
The TabActivity obtains location data in its onCreate method and then passes it to an AsyncTask, which then sends a request with that location to a server and receives a list of objets to display on map in ListView.
The problem is that i need to have MapActivity as default tab in TabActivity, and my MapActivity doesnt know when the AsyncTask in TabActivity finishes its doInBackGround method and obtains the data needed for overlays.
So things go like this:
1. TabActivity starts and attempts to start the MapActivity.
2. The AsyncTask is still comunicating with server and doesnt have the the stuff that has to be marked on map.
3. MapActivity doesnt know that there is no data for overlays yet and attempts to add them (the overlay adding code is in onCreate method).
4. Program crashes because of NullPointerException.
So basically i need to find a away to tell the MapActivity to WAIT for the AsyncTask to obtain the data from server and only then attempt to add overlays.
Any suggestions how to do this? I really have no clue how to do this, tried everything that could come to my mind, been googling for a solution whole day but no luck, please help