I'm trying to get my app to react to a long key press on volume down with the following code:
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
Log.w("myApp", "LONG PRESS");
}
return super.onKeyLongPress(keyCode, event);
}
However, it only spams a bunch of onKeyPress()
events for volume down, and onKeyLongPress()
never gets called. My intention is to leave the volume down and up "short" presses alone, and have my app react differently to the volume long press.
Can anybody point out what I'm missing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…