Im using Gluon to develop javafx applications to Android, Iphone (and to desktop). When I export a test application to my Android phone (Marshmallow 6.0) - I cannot hold down onto text to access the menu from where you can copy text (the context menu) (Which is an example of what you can do with a context menu - and is not a question of how to copy text on long hold specifically in Android).
This was possible on iphone 6 when testing it there.
How can I detected wether the device/operating system has a default context menu or not in java?
On Desktop there is a default
ContextMenuthat is created and installed inTextFieldBehavior(private API). If you don't set your own custom context menu, that will be the one used when aContextMenuEventis fired (with a right click event for instance).On mobile, both Android and iOS have a
ContextMenuas well.On iOS, it uses a native
TextField(UITextField). When the long press event happens, it triggers the default context menu (on my iPad I can see a small magnifying glass, and after that the context menu shows up).On Android, the JavaFX
TextFieldhas a custom skin, but shares the same privateTextFieldBehavioras the desktop version. The problem in this case is the missing right click event that would trigger theContextMenuEventevent.That's why you have to fire manually a
ContextMenuEventevent, as it was described in this question.Conclusion: so far, this is basically required only on Android: