Update ListView item
Published in
1 min readNov 2, 2015
For a podcast app I had been working on that show a list of episodes, I wanted to do two things:
- When the user clicked to download an episode show a progress bar for that specific row and continue to update it all through the download process
- Show a “how far have you listened”-progress bar for each episode
A screenshot of the finished design:
Implementing this however, was somewhat tricky. I won’t go in to detail on all the things I tried but will instead just outline the best solution I came up with.
Three part implementation
- An AsyncTask that gathers meta data
- A scroll listener that tells us when the user has stopped scrolling/flinging
- A clever algorithm that finds any visible row that needs updating and asks the adapter to only update that specific row
For the complete code see GitHub, the code below is shortened and incomplete.
This seem to be working pretty well even on older hardware.
(Originally published 2013–11–25)