Galaxy Tab S9 FE+: Can't get any spen specific events

Hello, i’m currently working on a drawing app, but there are parts of the pen events i can’t get.

Questions:
I can get all pointer related events fine, but I can’t get the button press event. How do i get those ?
Also, on some scroll views, i want to disable the air preview auto scroll feature, how can that be done ?

  • Tried the race car app, which is the demo app from samsung to showcase the spen features, but none of the gestures nor the button to pause works.
  • Tried all the onXX events: onTouch, onKeyDown, dispatchTouches, onHover, onGenericMotionEvent, none of them triggers when overriden in my scrollView subclass when i press the side button, and returning false doesn’t prevent the auto scroll feature.
  • Tried SPen Remote SDK, but it says that this tablet doesn’t support it.

I’m really confused on how to interact with those features.

Hello,
You can observe button action with the following code snippet:

    SpenUnit button = mSpenUnitManager.getUnit(SpenUnit.TYPE_BUTTON);
    mSpenUnitManager.registerSpenEventListener(mButtonEventListener, button);
    ...
    //EventListener for Button Unit
    private SpenEventListener mButtonEventListener = new SpenEventListener() {
        @Override
        public void onEventChanged(SpenEvent ev) {
            ButtonEvent buttonEvent = new ButtonEvent(ev)
            
            switch (buttonEvent.getAction()) {
                case ButtonEvent.ACTION_DOWN:
                    Log.d(TAG, "Spen Button Pressed");
                    break;
                case ButtonEvent.ACTION_UP:
                    Log.d(TAG, "Spen Button Released");
                    break;
            }
        }
    };

Please check out the link below:

Thank you,
Ummey

1 Like