• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Running Counter in Listitem without requery?

touchit

Lurker
Hello,
I would like to have a running counter (e.g. from 10 Minutes down to 0) in an List item. I have a cursor adapter and in a spezific field the time How long the counter should run.

I tried it with a background service which calls every minute a requery to the cursor to refresh the counter in the list item.
But now I have a conflict with other parts in the list which are also depends on cursor requeries.

Maybe somebody have a best practice for a running counter in an cursor adapter without calling requery?
 
thats correct, i am sure timer with a timertask is a good part to implement a timer.

But the actual problem is not to implement the Timer, my background service do this (maybe not in a good) but in a accurate way, the problem is to update the TextView in the List Item without a requery.

So somebody with an idea to update a TextView in an List item in an Cursor Adapter?

I tried to call the setText in the Textview object in my timer service, but get an error that I couldnt call a view element from another thread.
 
Thats why I recomended using a timer/timertask combo. With thst, you can use a Handler object to post back to the UI thread and call the setText method.
 
Back
Top Bottom