[Android-development] Handling Android volume keys
Tomasz Bojczuk
seelook at gmail.com
Tue Oct 18 09:28:52 CEST 2016
Hi,
QKeyEvent doesn't support Android volume keys. How to handle them then?
I found Java code:
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
int action = event.getAction();
int keyCode = event.getKeyCode();
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
if (action == KeyEvent.ACTION_DOWN) {
// emit something for c++
}
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
if (action == KeyEvent.ACTION_DOWN) {
// emit something for c++
}
return true;
default:
return super.dispatchKeyEvent(event);
}
}
and with available "Android on Qt "episodes I hope to be able to call my
c++ part from that.
But how and where the above code should be run?
Regards
Tomasz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20161018/6a497fb2/attachment.html>
More information about the Android-development
mailing list