Hello all,
I'm trying to think of a way on how to sync in between a local service and the main activity.
The local service has,
- A thread with a socket connection that could receive data at any time.
- A list/array with data.
- At any time the socket could receive data and add it to the list.
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.
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.
Any ideas?
Thanks.