I try to copy a value of a Textfield to the clipboard of the Smartphone. But I "activate" the native "copy paste" Option of my phone like regular, and do the Copy but the copied value is ONLY availiable in the Application, not outside of it.
EDIT: I implemented the "hold press" gesture, from the example here: Textfield copy action on long hold (copy popup)
But this only works inside the application. I can't access the system clipboard. I can do copy and paste inside the application. But not paste outside nor copy something from outside and Paste it inside the application.
So I trigger a event (button press) that should copy the Text to the clipboard
This is the portion of the Code that works fine on the Desktop, but does not copy anything to the clipboard of the smartphone.
TextField textfield = new TextField();
Button b = new Button("copy");
b.setOnAction(event -> {
Clipboard clipboard = Clipboard.getSystemClipboard();
//Alert to have some Information about the content of the clipboard
Alert alert = new Alert(AlertType.INFORMATION);
alert.setContentText("clipboard content before: " + clipboard.getContent(DataFormat.PLAIN_TEXT));
alert.showAndWait();
ClipboardContent content = new ClipboardContent();
content.put(DataFormat.PLAIN_TEXT, textfield.getText());
clipboard.setContent(content);
});
Is there something different on the smartphone ?
Or can I make "native" copy and Paste-Features working in the Application ?
On Desktop the alert will always show the last copied content.
on the Smart Phone it is always null, no matter what.
Any Idea how i should approach this ?