Tuesday, 15 July 2014

How to detect Hard/Soft back button on Android device? -



How to detect Hard/Soft back button on Android device? -

i want know how observe hard or soft "back button" on device? searched found code

@override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back && event.getrepeatcount() == 0) { // on back. homecoming true; } homecoming super.onkeydown(keycode, event); }

but need observe if there button exist on device or not in form of hard or soft.

i think should work

queries framework whether physical keys exist on keyboard attached device capable of producing given key code.

boolean hasbackkey = keycharactermap.devicehaskey(keyevent.keycode_back);

android developer documentation

android back-button back-button-control

No comments:

Post a Comment