Android application: showing overlay items in AsyncTask

Posted by user1707887 on Stack Overflow See other posts from Stack Overflow or by user1707887
Published on 2012-09-29T09:21:13Z Indexed on 2012/09/29 9:37 UTC
Read the original article Hit count: 162

I am building an android application that uses google maps to overlay items. The latitude and longitude for the items I get from a MySQL database. To do this I connect to a php script using HTTP in Async Task. My code for displaying items on the map is in the onPostExecute() method of Async Task.

Everything works fine but when I for example rotate the phone all my overlayed items disappear. How can I resolve this issue?

Should overlaying the items happen in the main thread? If so, I need to somehow pass the information from the async taks to the main thread, which I have looked into but have not been able to get that working. If somebody knows a good and right way to do this, I would really appreciate the help.

© Stack Overflow or respective owner

Related posts about android

Related posts about android-asynctask