title: Android: Modifying adapter content from a background thread
body: <p>I've read up quite a bit on the exception thrown while using BaseAdapter, but i can't seem to find an alternative solution:
  <strong>Make sure the content of your adapter is not modified from a background thread</strong></p>
  
  <p>What i want to achieve is to keep a copy of a message queue in memory, and use this message queue to populate the BaseAdapter for my ListView. The reason im doing this is that the message queue will keep getting messages from a socket even when the ListView is not currently present (for example a chat window). </p>
  
  <p>The problem comes when i have the <strong>Activity</strong> with the <strong>ListView</strong> in foreground, <strong>BaseAdapter</strong> binded to the message queue's data, and a message comes in the socket. Adding the new message into the queue will throw the exception mentioned above. Unless i pre-populate my <strong>BaseAdapter</strong> with the message queue (as in the BaseAdapter having its own message queue) and updating both of them when a new message come in, i can't really find a way around this issue.</p>
  
  <p>I don't really want to double up the effort on keeping those 2 queues up-to-date like this, surely there is a better way of doing this? Send broadcasts around doesn't work either because of the potential delay in the adapter serving a scroll and the notifyDataSetChanged call is made.</p>