Android, how to make a thread sleep?
<p>Here's my code that, upon a click of the "menu" button, slides 'menubtm' in or out of view. Is there a way to make it pause for a few milliseconds at every loop, so that it would be viable, how the menubtm moves?</p>

<p>Thanks!</p>

<pre><code>@Override
public boolean onKeyDown(int keycode, KeyEvent event ) {
 if(keycode == KeyEvent.KEYCODE_MENU){

    if ( menuBtmVisable == true )
    {
        menuBtmVisable = false;
        int xnow = menuBtmTopLimit;
        while (xnow&lt;menuBtmTopLimit+120)
        {   
        xnow+=1;
        AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams(480, 120, 0, xnow);
        menubtm.setLayoutParams(lp); 
        }
    }
    else
    {
        menuBtmVisable = true;
        int xnow = menuBtmTopLimit+120;
        while (xnow&gt;menuBtmTopLimit)
        {
        xnow-=1;
        AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams(480, 120, 0, xnow);
        menubtm.setLayoutParams(lp); 
        }
    }

 }
 return super.onKeyDown(keycode,event); 
}
</code></pre>

<p><strong>EDIT:
Thanks to your advice, I did it with animations.</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="0"
android:toYDelta="120"
android:duration="500"
 /&gt;
</code></pre>

<p><strong>This animation has to make the menu slide 120 px down... it does so ok, but then springs back into the old place. Is there a way to make it stay in the new location?</strong></p>

<p><strong>EDIT2 : got it!</strong></p>

<pre><code>android:fillEnabled="true"
android:fillAfter="true"
</code></pre>
