title: Reset Icon on scroll
body: <p>I have the following adapter:</p>
  
  <pre><code>package studios.verso.instrumentalringtones;
  
  import android.content.Context;
  import android.media.MediaPlayer;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class MyBaseAdapter extends BaseAdapter {
  
      ArrayList&lt;ListData&gt; myList = new ArrayList&lt;ListData&gt;();
      LayoutInflater inflater;
      Context context;
      static boolean playing = false;
      static int pause_button_position = -1;
  
  
  
      public MyBaseAdapter(Context context, ArrayList&lt;ListData&gt; myList) {
          this.myList = myList;
          this.context = context;
          inflater = LayoutInflater.from(this.context);    // only context can also be used
      }
  
      @Override
      public int getCount() {
          return myList.size();
      }
  
      @Override
      public ListData getItem(int position) {
          return myList.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          return 0;
      }
  
      MediaPlayer mp = new MediaPlayer();
      @Override
  
      public View getView(int position, View convertView, ViewGroup parent) {
          MyViewHolder mViewHolder;
  
          if (convertView == null) {
              convertView = inflater.inflate(R.layout.listview_item_row, null);
              mViewHolder = new MyViewHolder();
              convertView.setTag(mViewHolder);
          } else {
              mViewHolder = (MyViewHolder) convertView.getTag();
          }
  
  
          mViewHolder.tvTitle = detail(convertView, R.id.txtTitle, myList.get(position).getTitle());
          mViewHolder.tvDesc = detail(convertView, R.id.textView1, myList.get(position).getDescription());
          //mViewHolder.ivIcon = detail(convertView, R.id.imgIcon, myList.get(position).getImgResId());
  
          TextView tv = (TextView) convertView.findViewById(R.id.txtTitle);
          tv.setText("Testtt" + position);
          final int pos = position;
  
  
          final ImageView iv = (ImageView) convertView.findViewById(R.id.imgIcon);
          iv.setTag(position); //attach the position to your view
          iv.setImageResource(R.drawable.play_ic);
  
  
  
          iv.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                      try {
                          if (playing) {
                              Toast.makeText(context,
                                      "mMediaPlayer.isPlaying()",
                                      Toast.LENGTH_LONG).show();
  
                              try {
                                  mp.stop();
                                  mp.release();
                                  playing = false;
  
                                  iv.setImageResource(R.drawable.play_ic);
                                  notifyDataSetChanged();
                              } catch (Exception e) {
                                  // TODO: handle exception
                                  Toast.makeText(context, e + "",
                                          Toast.LENGTH_LONG).show();
                              }
  
                          } else {
  
                              iv.setImageResource(R.drawable.pause_ic);
                              pause_button_position = pos; //add
                              playing = true;
  
                              mp = MediaPlayer.create(context, R.raw.accordion_golden1);
                              //mp.prepare();
                              mp.start();
                              pause_button_position = pos;
                              Toast.makeText(context,
                                      "mMediaPlayer.start " + playing, Toast.LENGTH_LONG)
                                      .show();
                              notifyDataSetChanged();
  
                          }
                      } catch (Exception e) {
                          Toast.makeText(context, e + "" + ".....",
                                  Toast.LENGTH_LONG).show();
                      }
                  }
          });
  
          return convertView;
      }
  
      // or you can try better way
      private TextView detail(View v, int resId, String text) {
          TextView tv = (TextView) v.findViewById(resId);
          tv.setText(text);
          return tv;
      }
  
      private ImageView detail(View v, int resId, int icon) {
          ImageView iv = (ImageView) v.findViewById(R.id.imgIcon);
          iv.setImageResource(icon); //
  
          return iv;
      }
  
      private class MyViewHolder {
          TextView tvTitle, tvDesc;
          ImageView ivIcon;
      }
  
  }
  </code></pre>
  
  <p>For example if I will tap on play img, the sound will play fine, tap again on img will stop, and the icon is changing.</p>
  
  <p>After if I tap on play icon in first row and after I scroll up or down the play ico is resets from playing to paused and the music is still playing which is normally.</p>
  
  <p>What I can do to cancel update on scroll?</p>