title: Sync between local service with a thread and an activity
body: <p>I'm trying to think of a way on how to sync in between a local service and the main activity.</p>
  
  <p>The local service has,</p>
  
  <ul>
  <li>A thread with a socket connection that could receive data at any time.</li>
  <li>A list/array with data. </li>
  <li>At any time the socket could receive data and add it to the list.</li>
  </ul>
  
  <p>The activity needs to display this data. So when the activity starts up it needs to attach or start the local service and fetch the list. It also needs to be notified if the list is updated.</p>
  
  <p>I think I would need to sync my list somehow so the local service does not add a new entry to it while the activity fetches the list when connecting to the service.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks.</p>