how to share image using intent ?

TsubasaOzora

New Member
Hi,

i spend some time looking back and forward in this forum.. and still i cant get it to work. :(

how to share some image using intent actually ?

i can share a text using intent.. but that intent i need to write it manually

B4X:
dim share as intent
share.Initialize(share.ACTION_SEND,"")
share.SetType("text/plain")
share.PutExtra("android.intent.extra.TEXT", mytext)
share.WrapAsIntentChooser("Share text via")
StartActivity(share)

something like this work..
but if i use a file.. or i want to share image.. it doesnt work
any enlightenment ?

thanks
 
Do you want to send it with any specific app?

You can use the Email object from the Phone library to send emails with attachments.

Hi, basically i just want to share an image to twitter / facebook / social media

i try many tutorial in here but not work.. the closest one is this :

B4X:
Dim r As Reflector
Dim f As Object
f = r.CreateObject2("java.io.File", Array As Object("file:///sdcard/spectacle.pdf"), Array As String("java.lang.String"))
Dim share As Intent
share.Initialize(share.ACTION_SEND,"")
share.SetType("*/*")
share.PutExtra("android.intent.extra.STREAM", r.RunStaticMethod("android.net.Uri", "fromFile", _
    Array As Object(f), Array As String("java.io.File")))
share.WrapAsIntentChooser("Share PDF:)")
StartActivity(share)

since if i try this using :

B4X:
Dim r As Reflector
Dim f As Object
f = r.CreateObject2("java.io.File", Array As Object("file:///sdcard/spectacle.jpg"), Array As String("java.lang.String"))
Dim share As Intent
share.Initialize(share.ACTION_SEND,"")
share.SetType("image/*")
share.PutExtra("android.intent.extra.STREAM", r.RunStaticMethod("android.net.Uri", "fromFile", _
    Array As Object(f), Array As String("java.io.File")))
share.WrapAsIntentChooser("Share JPG:)")
StartActivity(share)

it will have some image icon,, but there is no image there.. :(

so how actually i do this thing ?
 
Upvote 0
Top