Android Question File Provider share file with text description

Alexander Stolte

Expert
Licensed User
Longtime User
Hello,

i have this code to share a file:

B4X:
    Dim in As Intent
        in.Initialize(in.ACTION_SEND, "")
        in.SetType("text/plain") 'it is not related to the file itself.
        in.PutExtra("android.intent.extra.STREAM", Main.fun.CreateFileProviderUri(Starter.shared, "share.jpeg"))
        in.WrapAsIntentChooser("Sharing")
        
        in.Flags = 1
        StartActivity(in)

How can i add a text description?
I mean for example if i share a image with whatsapp then i want to add a standard text
 

asales

Expert
Licensed User
Longtime User
I use this:

B4X:
Sub PostWhatsapp
    Dim intent As Intent
    intent.Initialize(intent.ACTION_SEND,"")
    intent.SetType("image/jpg")
    intent.SetComponent("com.whatsapp/.ContactPicker")
    intent.putExtra("android.intent.extra.TEXT", "put your text here")
    intent.PutExtra("android.intent.extra.STREAM", CreateFileProviderUri(Starter.SharedFolder, "myimage.jpg"))

    StartActivity(intent)
End Sub
 
Upvote 0
Top