Android: Repeat a dispatchKeyEvent while while a button is selected, focused, or pressed
<p>My layout contains a button and an editText view. While the button is held down I want to have a keyboard key pressed over and over again until the button is released.
Here is the basic concept:</p>

<pre><code>while(button is held down){

dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,
                KeyEvent.KEYCODE_P));

dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,
                KeyEvent.KEYCODE_P));

}
</code></pre>

<p>Can anybody help me with this?</p>
