2 or more keys pressed at the same time
<p>Hi guys I have been working with android recently and it's fine until now.</p>

<p>When I want to handle a key down event I just override the onKeyDown method in my activity. The same with the key up event.</p>

<p>The problem is that this just works for a single key, if I press to keys at the same time just one is handle.</p>

<p>For example:</p>

<pre><code>@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
    boolean returnValue = super.onKeyDown(keyCode, event);
    switch(keyCode){
        case KeyEvent.KEYCODE_A:
            //Do something awesome here
        return true;

        case KeyEvent.KEYCODE_C:
            //Do something even more awesome here
        return true;
    }
    return returnValue;
}
</code></pre>

<p>If I press 'A' and 'C' at the same time one is processed first.</p>

<p>My first idea was to set flags with the onKeyDown event to keep the track of what keys are pressed and clear the flags with the onKeyUp event, but this failed when I switch between activities.</p>

<p>Now what I want is something like the following:</p>

<pre><code>@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
    boolean returnValue = super.onKeyDown(keyCode, event);
    switch(keyCode){
        case KeyEvent.KEYCODE_A:
            if(/* C is pressed */){
                //Do something not so awesome here
            }
            else{
                //Do something awesome here
            }
        return true;

        case KeyEvent.KEYCODE_C:
            if(/* A is pressed */){
                //Do something not so awesome here
            }
            else{
                //Do something even more awesome here
            }
        return true;
    }
    return returnValue;
}
</code></pre>
