Hi,
was looking for clipboard copy and paste functions without using an external library. The JavaObject offers such a possibility - see below.
Questions:
was looking for clipboard copy and paste functions without using an external library. The JavaObject offers such a possibility - see below.
Questions:
- Do JavaObjects remain in memory once there are created or are these released after functions like below have been used?
- If not the case, how to release JavaObjects?
B4X:
' CopyStringToClipboard via JavaObject
' Parameter: String
Sub CopyStringToClipboard(s As String)
Dim ta As TextArea
ta.Initialize("ta")
ta.Text = s
ta.SelectAll
Dim jo As JavaObject = ta
jo.RunMethod("copy", Null)
End Sub
' PasteStringFromClipboard via JavaObject
' Return: String
Sub PasteStringFromClipboard As String
Dim ta As TextArea
ta.Initialize("ta")
Dim jo As JavaObject = ta
jo.RunMethod("paste", Null)
ta.SelectAll
Return ta.Text
End Sub