I want to be able to detect a single click or a double click when the menu button is pressed. If a single click is detected one even will happen, if a double click is detected a different event will happen. Here is what I've tried(Using toast in place of events):
private static final long DOUBLE_PRESS_INTERVAL = 250; // in millis
private long lastPressTime;
@Override
public boolean onPrepareOptionsMenu(Menu menu) {    
    // Get current time in nano seconds.
    long pressTime = System.currentTimeMillis();
    // If double click...
    if (pressTime - lastPressTime <= DOUBLE_PRESS_INTERVAL) {
        Toast.makeText(getApplicationContext(), "Double Click Event", Toast.LENGTH_SHORT).show();
        return true;
    }
    // If not double click....
    Toast.makeText(getApplicationContext(), "Single Click Event", Toast.LENGTH_SHORT).show();
    // record the last time the menu button was pressed.
    lastPressTime = pressTime;      
    return true;
}
The problem is that a single click event is detected every time before a double click event.