Вопрос

Is any possibility to override this two menu keys (marked on the picture) by my own functionallity? I would like to override this two keys for specified in game functionality. enter image description here

Это было полезно?

Решение

To override Menu button you can go with the following code..

public void makeContextMenu(ContextMenu contextMenu) {
    // Write your code here.
}

To override Back button there are two options to override close() method as well as override keyDown(int keycode, int time) method

1. keyDown(int keycode, int time)

protected boolean keyDown(int keycode, int time) {
    int key = Keypad.key(keycode);
    if (key == Characters.ESCAPE) {
        // do something here
        return true;
    }
    return super.keyDown(keycode, time);
}

2. close()

public boolean onClose() {
    if (someCondition) {
        // do something
        return false;
    } else
        return super.onClose();
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top