- Knowledge Base
- Developer
- HMT Development Examples
-
Developer
-
RealWear Navigator™ 500 Series
- Overview
- Features and Specifications
- Wearing Your Device
- Device Setup
- Interacting with Your Device
- Device Power
- Battery Use
- Home Screen
- My Programs
- My Camera
- My Files
- My Training
- Safety
- Device Care
- Ownership Information
- User Guide
- FAQ
- Thermal Camera Module
- Display Technology Comparison
- Cleaning Your Device
-
RealWear Cloud
-
RealWear Releases
-
RealWear HMT-1®
-
RealWear HMT-1Z1®
-
RealWear Apps
-
Configure
-
RealWear Modules & Accessories
-
RealWear Navigator™ Series
Development Example – Action Button
The default behavior of the action button is to navigate the user back to the system’s home screen. This behavior can be overwritten by an application if required. Since this changes the behavior that the user may expect it is not recommended to use this feature often.
Before capturing the action button you should disable the default behavior of navigating to the home screen:
@Override
protected void onCreate(Bundle savedInstanceState) {
// Disable the action button default behavior
mActionButtonImageView.setContentDescription("hf_no_ptt_home");
}
The action button functions as a normal key press and so can be handled in the standard Android way for any other key press. The action button’s key code is set to 500.
private static final int ActionBtnKeyCode = 500;
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case ActionBtnKeyCode:
// Action key is down - return true to stop default behavior
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
switch (keyCode) {
case ActionBtnKeyCode:
// Action key has been released - return true to stop default behavior
return true;
}
return super.onKeyUp(keyCode, event);
}