how to identify adapter odd and even number android

Solutions on MaxInterview for how to identify adapter odd and even number android by the best coders in the world

showing results for - "how to identify adapter odd and even number android"
Amelie
19 Jan 2018
1@Override
2public void onBindViewHolder(ViewHolder holder, int position)
3{
4  if(position % 2 == 0) 
5  {
6     //holder.rootView.setBackgroundColor(Color.BLACK);
7     holder.rootView.setBackgroundResource(R.color.black);
8  }
9  else 
10  {
11     //holder.rootView.setBackgroundColor(Color.WHITE);
12     holder.rootView.setBackgroundResource(R.color.white);
13  }
14}
similar questions