Make button appear and then disappear after a few seconds in Android
<p>I have a few Buttons that I want to appear randomly and then disappear after a few seconds. I would also like them to be clickable when they are visible if that changes anything.</p>

<p>Here's what I have:</p>

<pre><code>public void fight() throws InterruptedException
{
    Random g = new Random();
    int move;
    for(int i = 0; i &lt;= 3; i++)
    {
        move = g.nextInt(8);
        buttons[move].setVisibility(View.VISIBLE);
        buttons[move].setClickable(true);

        try{ Thread.sleep(5000); }catch(InterruptedException e){ }

        buttons[move].setVisibility(View.GONE);
        buttons[move].setClickable(false);
    }

}
</code></pre>

<p>When I try that though, the whole thing just freezes for 20 seconds (presumably 5 seconds for each time through the loop and nothing happens. Any ideas?</p>

<p>Thanks.</p>
