Home > Net >  How to have a longPress Event on a CheckBox in Codenameone?
How to have a longPress Event on a CheckBox in Codenameone?

Time:03-21

i need to implement a long press event on a checkbox in codenameone. On normal buttons i use the longPointerPress method and a boolean to control if the short- or longpress event happens. With the checkboxes i cannot find that option, it only toggles between checked/unchecked.

How is it possible to use a long press on a checkbox?

Thanks for your help!

CodePudding user response:

I'm not familiar with codenameone, but in Android you can just use setOnLongClickListener since every View has that function.

CodePudding user response:

longPress is a callback. You don't invoke it, you override it and it triggers when a longpress occurs. So Codename One invokes it internally. See the answer here: https://stackoverflow.com/a/54063388/756809

  • Related