your code is trying to change the background of the button. not its image.
Those are two different things
((ImageButton) view).setImageResource(R.drawable.icon2);
your code is trying to change the background of the button. not its image.
Those are two different things
((ImageButton) view).setImageResource(R.drawable.icon2);