mardi 27 octobre 2015

How to update a single TextView with a Loader

I have recently implemented Loaders in my application for populating listviews and spinners, which I find a great improvement over my previous, more ui-boggling-rudimentary approach, but that is another story.

I am in a situation where I want to update a simple TextView element of my main scrren with the Count(*) result of a SQLite table that can be udpated in the background by the service that listens for network calls. This TextView is not visible all the time, but just on the main screen.

So, I am basically asking if there is any way of implementing a listener in the provider so that this TextView gets updated automatically whenever a new element is inserted in a specific table.

Since I am not loading a collection of items I don't think a CursorLoader is to use, and I cannot set an adapter for a TextView.

Any Ideas? Thanks!

Aucun commentaire:

Enregistrer un commentaire