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.
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
Instead of trying to show the remaining time for all, the idea is to update the remaining time for the items which are visible.
Please follow the following sample code and let me know :
MainActivity :
activity_main.xml :
list_item.xml