I want to get a Long press key in a virtual android keyboard. I saw this code
@Override
public boolean onLongPress(Keyboard.Key key) {
System.out.print("Get in long press");
if (key.codes[0] == '1') {
getOnKeyboardActionListener().onKey('!', null);
return true;
}
else
return false;
}
from this answer
. However, the getOnKeyboardActionListener
on the KeyboardView has access protected.
Alone says cannot resolve method, but
mInputView.getOnKeyboardActionListener().onKey('!', null);
says access protected.
I add a print line, but if I remove all lines, leave only the print and do a long press on emulator, dont show the message on android Studio.
How can I solve this problem with this code or implement with another code?