how to put delay in among multiple task in android
<p>I want to introduce 5-seconds delay while changing the background image of my different BUTTONS dynamically, you can see my code here below. I test number built-in method for delay i.e SLEEP(), WAIT() etc but, it gets sleep my application.</p>

<p>Please somebody help me in developing "myDelayMethod(mSeconds);"</p>

<p>I will be very thakfull to you.</p>

<pre><code>int mSeconds =5;//Seconds 

for(number=1; number&lt;5;number++)
{
    if(number==1)
    {
    buttonLED1.setBackgroundResource(R.drawable.buttonyellow);
    myDelayMethod(mSeconds);
    buttonLED1.setBackgroundResource(R.drawable.buttonblue);
    myDelayMethod(mSeconds);
    }


    else if(number==2)
    {
    buttonLED2.setBackgroundResource(R.drawable.buttonyellow);
    myDelayMethod(mSeconds);
    buttonLED2.setBackgroundResource(R.drawable.buttonblue);
    myDelayMethod(mSeconds);
    }


    else if(number==3)
    {
    buttonLED3.setBackgroundResource(R.drawable.buttonyellow);
    myDelayMethod(mSeconds);
    buttonLED3.setBackgroundResource(R.drawable.buttonblue);
    myDelayMethod(mSeconds);
    }


    else if(number==4)
    {
    buttonLED4.setBackgroundResource(R.drawable.buttonyellow);
    myDelayMethod(mSeconds);
    buttonLED4.setBackgroundResource(R.drawable.buttonblue);
    myDelayMethod(mSeconds);
    }
}
</code></pre>
