简体   繁体   中英

Volumns key detection for android device

Is there any way to detect the existence of the VOLUMN keys for android devices? Some features should be hidden if there no VOLUMN keys. Appreciate for any help^.^

For Volume Keys use KEYCODE_VOLUME_DOWN and KEYCODE_VOLUME_UP

@Override
 public boolean onKeyLongPress(int keyCode, KeyEvent event) {
     if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) 
     {
       // to your stuff here
       return true;
     }
 return super.onKeyLongPress(keyCode, event);
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM