I am building a custom adapter for a listview - I would like this adapter to give the listview alternating background colours.
boolean alternate = false; @
You can use this code:
if (position % 2 == 0) { holder.image.setBackgroundResource(R.drawable.image1); } else { holder.image.setBackgroundResource(R.drawable.image2); }