title: Android: Handle ListView Recycle
body: <p>I am developing a soundboard application in which I use Listview Activity. But since Listview of Android has the property of recycling its listviews, <strong>the changes I make to the selected textview gets reflected in all the pages while scrolling the listview.</strong> 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!</p>
  
  <p>Edit: Hope this will explain better</p>
  
  <p>My class extends ListActivity and the listview is as follows</p>
  
  <pre><code>[Image] [Text]
  [Image] [Text]
  [Image] [Text]
  </code></pre>
  
  <p>Now when the user clicks on any textview, I need to change the image of that textview. I implement that by the following code.</p>
  
  <pre><code>public void onItemClick(AdapterView&lt;?&gt; 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);
  
  
        }
      };
  }
  </code></pre>