I have a service which reads data from a Socket connection and during peak hours. The frequency of the changes is every five seconds.
I have two options in mind.
Update the
List
, using aBroadCastReceiver
.Create a new
Thread
in theActivity
where I created theList
, read a static variable every five seconds, and when the change occurs, change the static variable from theService
.
Which option is more efficient and what are the pros and cons of both? If you think there is a better option, please let me know.
Thank you.