I set my listview as follows and can change the icon that I am clicking to pause. However I cannot figure how to select an icon to change back to play that was clicked earlier.
public View getView(int position, View convertView, ViewGroup parent) {
final int posi = position;
View row=convertView;
if (row==null) {
LayoutInflater inflater=getLayoutInflater();
row=inflater.inflate(R.layout.team_list_item, parent, false);
}
TextView tlabel=(TextView)row.findViewById(R.id.teamname);
tlabel.setText(FranchiseName[position]);
TextView thlabel=(TextView)row.findViewById(R.id.teamtheme);
thlabel.setText(shaveSong(FranchiseTheme[position]));
ImageView icon=(ImageView)row.findViewById(R.id.speaker);
icon.setImageResource(R.drawable.play);
icon.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
((ImageView) v).setImageResource(R.drawable.pause);
if (!(PlayingSongNo == 0)) { // reset icon of PlayingTeam
// set old icon to play
}
PlayingSongNo = posi + 1;
}
}
});
return(row);
}
The icon I want is on the PlayingSongNo row. How can I setResource on this other icon?