On key down loop until key up
<p>What I have is a seekbar which is controlled by buttons rather than a slider using set/get progress.</p>

<p>I'm trying to get the seekbar progress to increase when a user presses a button and then stop increasing when they lift off the button. I have an onkey listener the detects up and down. I'm just not sure where to put the setprogress part, if I put a loop in on ACTION_DOWN, it's then looping rather than detecting ACTION_UP the same seems to happen if I have a while loop for ACTION_DOWN.</p>

<p>I think I may also have to set refreshDraweableState, but I've not had much look with that either.</p>

<p>Potentially i'm trying to mess with seekbars too much but I'd appreciate any help/advice. Thanks!</p>

<p>This is my keylistner which is where I have been mostly messing about.</p>

<pre><code>public boolean onKey(View view, int keyCode, KeyEvent event) {
    builder.setLength(0);
    switch (event.getAction()){
        case KeyEvent.ACTION_DOWN:
            builder.append(event.getKeyCode());
            String text = builder.toString();
            Log.w("seekbar", text);
            textView.setText(text);
            while (sk.getProgress() &lt; 100){
                sk.setProgress(sk.getProgress()+1);
                sk.refreshDrawableState();
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    break;
                }
            }
            break;
        case KeyEvent.ACTION_UP:
            break;
    }
    return true;
}
</code></pre>

<p>}</p>
