I set an image A for imageview of item in listview. I set the onclick event and change to another image B. But after clicking it can not change to another iamge. When I print Log I see this method has been called.
holder.bus_icon.setImageResource(R.drawable.bus_blue);
holder.bus_icon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.i("i", "点击图标了+test11" + position);
holder.bus_icon.setImageResource(R.drawable.bus_red);
adapter.notifyDataSetChanged();
}
});
Remove
adapter.notifyDataSetChanged();because you nothing changed in adapter and callholder.bus_icon.invalidate();.Hope this may help you.