NotifyDataChanged from service Android -


I have a service that updates the database on my Android APP, point to the idea that the same idea (list view) on the APP If I do not explicitly call the "myAdapter.notifyDataChanged ()" method. How can I do this with a service? Where I do not have any reference to the adapter and neither is it a carrying activity.

I thought of firing my own custom event, but I do not know whether this is possible in Android. I could not find anything on the API documentation.

Thanks in advance!

Use a message bus ( LocalBroadcastManager , etc, etc).

Or, use a Messenger .

Or, wrap your database in a ContentProvider and use CursorLoader to populate the adapter, as you change the contents In the new cursor that ContentProvider (assume that you implement it correctly).


Comments