Android Question Share image using file provider ?

hookshy

Well-Known Member
Licensed User
Longtime User
After using the code below, a picture can be viewed but share option is not enabled !
Is there a way you can add parameters to the intent object to tell him the image is finished and ready to be shared ?
When you edit the picture by adding an effect then save picture again, you can then share the image but users might not know what option to use, of might find this inappropriate. I find this very difficult to find another step in editing again the picture just to use the share option.

'code below works following the file provider library and examples
B4X:
    Dim FileName As String = "b4a.png"
    File.Copy(File.DirAssets, FileName, Starter.Provider.SharedFolder, FileName)
    Dim in As Intent
    in.Initialize(in.ACTION_VIEW, "")
    Starter.Provider.SetFileUriAsIntentData(in, FileName)
    'Type must be set after calling SetFileUriAsIntentData
    in.SetType("image/*")
    StartActivity(in)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code works with Markup app:
B4X:
Sub btnViewImage_Click
   Dim FileName As String = "b4a.png"
   File.Copy(File.DirAssets, FileName, Starter.Provider.SharedFolder, FileName)
   Dim in As Intent
   in.Initialize(in.ACTION_EDIT, "")
   Starter.Provider.SetFileUriAsIntentData(in, FileName)
   'Type must be set after calling SetFileUriAsIntentData
   in.SetType("image/*")
   StartActivity(in)
End Sub
 
Upvote 0
Top