when I use intent in anroid 7 I can not use the system gallery function,how can I solve it,thanks
picture 1 is b4a ,pictuire2 is open by android gallery,I want to get picture 2 by b4a
picture 1 is b4a ,pictuire2 is open by android gallery,I want to get picture 2 by b4a
B4X:
Sub Button1_Click
'copy the file to the shared folder
Dim p As Phone
Dim in As Intent
File.Copy(File.DirAssets, "b4a.png", Starter.shared, "b4a.png")
in.Initialize("android.intent.action.MEDIA_SCANNER_SCAN_FILE", CreateFileProviderUri(Starter.shared, "b4a.png"))
p.SendBroadcastIntent(in)
in.Initialize(in.ACTION_VIEW, CreateFileProviderUri(Starter.shared, "b4a.png"))
in.SetType("image/*")
in.Flags = 1
StartActivity(in)
End Sub
Sub CreateFileProviderUri (Dir As String, FileName As String) As Object
Dim FileProvider As JavaObject
Dim context As JavaObject
context.InitializeContext
FileProvider.InitializeStatic("android.support.v4.content.FileProvider")
Dim f As JavaObject
f.InitializeNewInstance("java.io.File", Array(Dir, FileName))
Return FileProvider.RunMethod("getUriForFile", Array(context, Application.PackageName & ".provider", f))
End Sub