How to cycle over 3 types of values in array [android]
<p>I want to know the algorithm to cycle through the sample array below in a order like color1 -> color3 -> color 2 when a button gets clicked each time.</p>

<p>int[] colorList = new int[]{color1, color2, color3};</p>

<p>Currently, Im trying to do it like the sample below but unable to do it. 
If possible would you give me a helping hand ? I cannot find a solution to transition in a order I desire. I would love to hear from you!</p>

<pre><code>void updateIndicators(int position) {
      for (int i = 0; i &lt; indicators.length; i++) {
          indicators[i].setBackgroundResource(
                  i == position ? R.drawable.indicator_selected : R.drawable.indicator_unselected
          );
      }
  }
</code></pre>