listAdapter change of pictures in one evidence cell and cleaning of others
-
The problem is that View is not being updated in the leaf, and when you press 1, push 11, too, help me figure it out.
holder.play_pauseAudio.setTag(1); holder.play_pauseAudio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (Integer.parseInt(holder.play_pauseAudio.getTag().toString()) == 1) { holder.play_pauseAudio.setImageResource(R.drawable.pause_action); holder.play_pauseAudio.setTag(2); } else { holder.play_pauseAudio.setImageResource(R.drawable.play_action); holder.play_pauseAudio.setTag(1); } } });
-
- We need to keep the play/pase for all the elements in the adapter. For example,
ArrayList<Boolean> states = new ArrayList<>();
- And in getView, put the right image on these values.
- When compressed, change the condition of the specific element in the list stored in the adapter (see p1). And call for a refill of all the elements of the adapter... There's a method.
Adapter.notifyDataSetChanged()
It's even easier:
Maintain the position of the compressed element and provide a picture of the glue/pause at the position held in
int
variable adapter.I mean, getView check that the position-argument matches the value of the alternator and put the play. Otherwise, pause, and onClick assign the value of this variable and call it
notifyDataSetChanged()
- We need to keep the play/pase for all the elements in the adapter. For example,