notifyDataSetChanged only refreshes GridView once, despite being called multiple times
<p>I will attempt to summarize my code as follows:</p>

<ul>
<li>I have a TileAdapter which extends from BaseAdapter to populate a GridView</li>
<li>My TileAdapter contains an array of Tiles that is used to maintain state</li>
<li>My TileUpdate class performs the following operations:
<ol>
<li>Changes Tile A's colour to green</li>
<li>Calls TileAdapter.notifyDataSetChanged()</li>
<li>Changes Tile B's colour to yellow</li>
<li>Calls TileAdapter.notifyDataSetChanged()</li>
<li>Changes Tile B's colour to red</li>
<li>Calls TileAdapter.notifyDataSetChanged()</li>
</ol></li>
</ul>

<p>I would have expected to see my GridView refresh 3 times, once for each call to notifyDataSetChanged().</p>

<p>However, I only see it refresh after step 6, when and never see Tile B turn yellow.</p>

<p>What is happening here? I presume there is some part of the API I'm not aware of.</p>

<p>Thanks</p>

<p><strong>Update</strong></p>

<p>I still have not been successful in implementing this, even after studying the Handler approaches described below.
So in my UI thread I've created a new GridOperationQueue class which extends from Thread:</p>

<pre><code>public class GridOperationQueue extends Thread {
private Handler handler;

@Override
public void run() {
    Looper.prepare();

    handler = new Handler();

    Looper.loop();  

}

public void addTaskToQueue(final GridUpdateTask task)
{
    Log.d(this.getClass().toString(), "Current thread is ID " + Thread.currentThread().getId());
    handler.post(new Runnable()
    {
        @Override
        public void run() {
            Log.d(this.getClass().toString(), " Handler task's current thread is ID " + Thread.currentThread().getId());
            task.run();
        }

    });
}

public void clearQueue(){
    handler.removeCallbacksAndMessages(null);
}
</code></pre>

<p>}</p>

<p>So my UI thread invokes addTaskToQueue providing a new Task object. The idea is that the task's processing will be performed on a separate thread and after it completes invokes a notifyDataSetChanged() on the UI thread.
However, I've added some logging and it seems that when my tasks run they are still running on the main thread....how would this be? See the following logging:</p>

<pre><code>GridOperationQueue(4393): Current thread is ID 1
GridOperationQueue(4393): Current thread is ID 1
GridOperationQueue(4393): Current thread is ID 1
GridOperationQueue$1(4393):  Handler task's current thread is ID 9
TileOperationService$1(4393): Current thread is ID 9
MyActivity(4393): Current thread is ID 9
GridOperationQueue$1(4393):  Handler task's current thread is ID 9
TileOperationService$2(4393): Current thread is ID 9
MyActivity(4393): Current thread is ID 9
GridOperationQueue$1(4393):  Handler task's current thread is ID 9
TileOperationService$3(4393): Current thread is ID 9
MyActivity(4393): Current thread is ID 9
</code></pre>

<p>How come the tasks are still running on the main thread?</p>
