Pressing down or holding down 'T' results in the "T UP" log statement being executed repeatedly, as opposed to only when the key is released, which should not be the intended behavior. Help appreciated!
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP &&
event.getKeyCode() == KeyEvent.KEYCODE_T) {
Log.d("KEYACTION", "T UP");
}
return false;
}
}```
I originally tried using both the onKeyDown and onKeyUp overrides independently, and the issue became apparent. Using dispatchKey was the alternative solution but has also not worked properly.