title: Highlight buttons one at a time
body: <p>I am making an Android game modeled after the old Simon game. It is a little different in the layout as it is using a 3x3 layout of buttons. I am trying to get the buttons to light up one at a time inside the loop that randomly selects a button. The trouble I have is that all of the buttons light up at once and only the last (or first, not sure) changes back to the original color. I have tried very thoroughly to find an appropriate answer to my situation but have had no luck here or elsewhere. The button id(s) are in the butts[]. butts[0] is button 1, butts[2] ... Below is my attempt.</p>
  
  <pre><code>public void play()
  {
    for(int x = 0; x &lt;= numButtons; ++x)
    {
        spot = randomGenerator.nextInt(9);
        playMe[x] = spot;
        //butts[spot].setBackgroundColor(Color.parseColor("#540115"));
        handler.postDelayed(new Runna(spot), (x+1)*1000); 
    }
  }
  class Runna implements Runnable 
  { 
    public Runna(int j2) 
    {
        butts[j2].setBackgroundColor(Color.parseColor("#540115"));
    }
    public void run() 
    {  
      butts[spot].setBackgroundColor(Color.LTGRAY);
    }
  }
  </code></pre>