I am developing a soundboard application in which I use Listview Activity. But since Listview of Android has the property of recycling its listviews, the changes I make to the selected textview gets reflected in all the pages while scrolling the listview. I don't want this to happen. So how do I handle it properly. If somebody can help me out with code snippet, it will be really helpful and I appreciate your effort. Thank you!
Edit: Hope this will explain better
My class extends ListActivity and the listview is as follows
[Image] [Text]
[Image] [Text]
[Image] [Text]
Now when the user clicks on any textview, I need to change the image of that textview. I implement that by the following code.
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
TextView tv = (TextView) view;
//Here I change the image with tv as reference
final Resources res = getBaseContext().getResources();
final Drawable myImage = res.getDrawable(R.drawable.pause);
// myImage.
final Drawable myImage1 = res.getDrawable(R.drawable.play);
tv.setCompoundDrawablesWithIntrinsicBounds(myImage, null, null, null);
MediaPlayer.OnCompletionListener listener = new MediaPlayer.OnCompletionListener(){
public void onCompletion(MediaPlayer mp) {
tv.setCompoundDrawablesWithIntrinsicBounds(myImage1, null, null, null);
}
};
}