I am working with a multimedia player. Where song list is shown on listView. so for example if first song is playing the first row should marked as playing and other row should unmarked. Then if user click on third or second or any other row then current row should be unmarked. And clicked row should marked. Here marked and unmarked mean Play
and Pause
. I do play and pause toogle with same row. But how to change the element of earlier row? Can I store View
of earlier row in a View
? or anything else?
Here is the code of setOnClickListener
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ImageView imagEar = (ImageView) viewEar.findViewById(R.id.thumb);
imagEar.setImageResource(R.drawable.pause);
imagEar.setTag("pause");
viewEar = v;
if(imageView.getTag().toString().equals("play")){
imageView.setImageResource(R.drawable.pause);
imageView.setTag("pause");
}else if(imageView.getTag().toString().equals("pause")){
imageView.setImageResource(R.drawable.play);
imageView.setTag("play");
}
}
});
I already declared View viewEar;