Detecting button presses
2 min
The ARxWear headset features 5 physical raised push buttons.
Each button is referenced like so:
ArxButton.Circle
ArxButton.Square
ArxButton.Triangle
ArxButton.VolumeDown
ArxButton.VolumeUpBy default no functions are associated with the buttons, it is up to you to assign them. In order to detect button click use the following override function in your MainActivity:
override fun onButtonClick(button: ArxButton) {
if(button == ArxButton.Circle){
Snackbar.make(
findViewById<UVCCameraTextureView>(R.id.camera_view),
"Circle button short press",
Snackbar.LENGTH_LONG
).show()
}
}For long click, use the following:
override fun onButtonLongClick(button: ArxButton) {
if(button == ArxButton.Circle){
Snackbar.make(
findViewById<UVCCameraTextureView>(R.id.camera_view),
"Circle button long press",
Snackbar.LENGTH_LONG
).show()
}
}