Android Question Share multiple images

kalil

Member
Hi every one i'm new here,
i would like to share multiple images at the same time please i need some help
i tried this code from Erel but it shares only one image how can i share multiple images?
B4X:
Dim FileName As String = "im1.png"
    File.Copy(File.DirInternal, FileName, Provider.SharedFolder, FileName)
    Dim in As Intent
    in.Initialize(in.ACTION_VIEW, "")
    Provider.SetFileUriAsIntentData(in, FileName)
    'Type must be set after calling SetFileUriAsIntentData
    in.SetType("image/*")
    StartActivity(in)
 
Solution
B4X:
Dim files As List
files.Initialize
files.Add(Starter.Provider.GetFileUri(FileName1)) 'copy files to the shared folder
files.Add(Starter.Provider.GetFileUri(FileName2))
Dim in As Intent
in.Initialize("android.intent.action.SEND_MULTIPLE", "")
in.As(JavaObject).RunMethod("putParcelableArrayListExtra", Array("android.intent.extra.STREAM", files))
in.Flags = 1'FLAG_GRANT_READ_URI_PERMISSION
in.SetType("image/*")
Try
    StartActivity(in)
Catch
    Log(LastException)
End Try

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Dim files As List
files.Initialize
files.Add(Starter.Provider.GetFileUri(FileName1)) 'copy files to the shared folder
files.Add(Starter.Provider.GetFileUri(FileName2))
Dim in As Intent
in.Initialize("android.intent.action.SEND_MULTIPLE", "")
in.As(JavaObject).RunMethod("putParcelableArrayListExtra", Array("android.intent.extra.STREAM", files))
in.Flags = 1'FLAG_GRANT_READ_URI_PERMISSION
in.SetType("image/*")
Try
    StartActivity(in)
Catch
    Log(LastException)
End Try
 
Upvote 0
Solution
Top