Android Question How to make Copy text and share

WofaCle

Member
Please when i run this code it copy the text to clipboard but when sharing it comes empty no text how do i fix this thank you for helping

Copying text to clipboard and share via different platforms:
Private Sub copyLbl_Click
    Dim textCopy As BClipboard
     textCopy.clrText
    textCopy.setText(descLabel.Text)
    ToastMessageShow("Text copied to clipboard", True)
    descLabel.Text = textCopy.getText
    
    Dim Intent As Intent
    Intent.Initialize(Intent.ACTION_SEND, "" )
    Intent.SetType("text/plain")
    Intent.PutExtra("android.intent.extra.TEXT", (textCopy))
    Intent.WrapAsIntentChooser("Share Via")
    StartActivity(Intent)

End Sub
 
Solution
B4X:
'replace
Intent.PutExtra("android.intent.extra.TEXT", (textCopy))
'with
Intent.PutExtra("android.intent.extra.TEXT", (descLabel.Text))
you can not send a BClipboard-object via Intent. You must send the TEXT!

DonManfred

Expert
Licensed User
Longtime User
B4X:
'replace
Intent.PutExtra("android.intent.extra.TEXT", (textCopy))
'with
Intent.PutExtra("android.intent.extra.TEXT", (descLabel.Text))
you can not send a BClipboard-object via Intent. You must send the TEXT!
 
Upvote 1
Solution
Top