broadcastreceiver - How to update a List from a Service in Android? -


i have service reads data socket connection , during peak hours. frequency of changes every 5 seconds.

i have 2 options in mind.

  1. update list, using broadcastreceiver.

  2. create new thread in activity created list, read static variable every 5 seconds, , when change occurs, change static variable service.

which option more efficient , pros , cons of both? if think there better option, please let me know.

thank you.

i use broadcastreceiver (with localbroadcastmanager) option. recommend make model class implement parcelable. avoid solution 2


Comments