Issue
I can plot overlay markers on a map easily, but the requirements for this project ask for the addition of several hundred overlay markers. Obviously this causes ANRs all over the place.
I cannot use an AsyncTask to handle the addition of the overlay markers as the task cannot access the views.
So how can I move the addition of these overlays to the MapView in such a way that the app does not ANR?
Or is the realistic limit to the number of overlay markers I can plot much more limited?
Solution
Override the onPostExecute
and onProgressUpdate
methods of the AsyncTask to hop onto the UI thread. You can manipulate your UI from within there. Remember to keep all the grunt work in the doInBackground
method.
Trying to fire off a few hundred AsyncTasks is not a good idea so I recommend using a queue that a fixed number of AsyncTasks consume requests off.
Your next problem is dealing with performance when the user manipulates the map.
Answered By - Che Jami
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.