I tried the following but it is not working.
B4X:
Sub SetTextToClipboard (Text As String)
Dim Pasteboard As NativeObject
Dim general As NativeObject = Pasteboard.Initialize("UIPasteboard").GetField("generalPasteboard")
general.RunMethod("setString:", Array As Object(Text))
End Sub
Sub GetTextFromClipboard As String
Dim Pasteboard As NativeObject
Dim general As NativeObject = Pasteboard.Initialize("UIPasteboard").GetField("generalPasteboard")
If general.IsInitialized Then
Dim blnHasString As Boolean = general.GetField("hasStrings")
If blnHasString Then
Dim value As Object = general.RunMethod("string", Null)
Return value
End If
End If
Return ""
End Sub