How handle all input key an touch event incoming to my Android application?
Is any one place where I can catch all this events?
How handle all input key an touch event incoming to my Android application?
Is any one place where I can catch all this events?
Check these out:
http://developer.android.com/reference/android/view/View.OnTouchListener.html
http://developer.android.com/reference/android/view/View.OnKeyListener.html
Just add the following to your initial Activity:
// generic Key Listener
public boolean onKeyDown(int keyCode, KeyEvent event) 
{
    Log.d("Activity", "Key pressed"+keyCode);
    switch (keyCode) 
    {
        case KeyEvent.KEYCODE_BACK:
            Log.d("Activity", "Back Key pressed");
        return true;
        case KeyEvent.KEYCODE_MENU:
            Log.d("Activity", "Menu Key pressed");
        return true;
        case KeyEvent.KEYCODE_HOME:
            Log.d("Activity", "Home Key pressed"); // doesn't Print!
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
Note, you CAN'T capture the Home key!