How to work with AsyncTask and threads?
<p><em><strong>The goal:</em></strong><br>
Using Google App Engine server and Android client, I'm trying to put on the Google map at the Android client Users overlays. Every 30 seconds I'm polling the server and getting Vector that contains users and adding it to the map.</p>

<p><em><strong>Current status:</em></strong><br>
I'm dong all that using in one new thread, So after running the app I got:<br>
weird behaviors(delayed overlays, multiple overlays) and after that crushed with <code>ConcurrentModificationException</code>.<br>
After reading a bit i figured out that I need to work with <strong>AsyncTask</strong>.</p>

<p>Correct me if I'm wrong,But I understand that everything done in the Activity at at onCreate is "running" in UIhread so I need to put the "Logic" (All the Network handling) in doInBackground and all the UI Handling like putting overlays on the map in onPostExecute.</p>

<p>My Question are:<br>
1) In the current status I'm doing:</p>

<pre><code>new Thread()
{
    @Override
    public void run() 
    {           
        super.run();
        while(true)
        {
            SystemClock.sleep(30000);   
            Vector responseFromServer = getUsersVectorFromServer();             
            putNewOnlineUserOnTheMap();
        }           
    }
}.start();
</code></pre>

<p>What is the right way to convert this To AsyncTask?<br>
Do I poll the server still using new thread in the doInBackground or there is right way to do this?</p>

<p>2) Is there a specific list of what counts as UI to put in onPostExecute or any concepts list?<br>
In my case I guess that in need to put putNewOnlineUserOnTheMap() in onPostExecute.</p>

<p>Thanks.</p>
