I have a ListView where each item represents a podcast that can run up to 90 minutes. Selecting an item will display a SeekBar and start streaming in the audio from a URL using MediaPlayer.
I could use some pointers on how to handle maintaining the state of the SeekBar after it scrolls off the page and then scrolled back into view. I know that views are recycled and I’ve read that caching views in the adapter is a bad idea so I’m just wondering what other options there are.
It’s a bad idea to cache all your Views, except via the recycling mechanism. Caching one
SeekBar, or even a row containing aSeekBar, won’t be that big of a problem. Caching 1,000 rows is where the trouble lies.So, I’d note which
positionis the one for the playing podcast. In yourgetView()implementation in your adapter, if the requestedpositionis the one for the playing podcast, use your cached row. Otherwise, go through normal recycling.