Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle multiple countdown timers in ListView?

Tags:

I have a listview (with a custom list adapter), I need to display a countdown on every row.

For example, if my list contains 4 items, I will have 4 rows. At this point, I need to handle 4 different countdowns (one for each row) because time is different.

enter image description here

So far, I'm handling it the following way : in the Custom List Adapter, inside getView() method I create a new CountDownTimer and display remaining time inside TextView.

But the problem is that it slows the activity a lot, I can't even scroll correctly in the worst cases (because each time a row is displayed, it creates a new CountDownTimer).

I searched a lot for a better solution, but no one was satisfying.

Is there a cleaner and smoother solution to handle multiple countdown timers inside a listView ?

Thanks