Spright
Active Member
Is it possible to revcover the intent here becuase it uses quiet nice code but it uses external and uri which is an older way to solve this kind of problem.
I have a contentresolver solution but this one, actually has a crop inbuilt and nice animation so I would like to keep this code alive but make it more modern t use the non-dangerous filea access. Could someone help out to descibr how to do it?
I tried to add fileprovider but I'm not used to this so I should not continue wihtout some help first.
I have a contentresolver solution but this one, actually has a crop inbuilt and nice animation so I would like to keep this code alive but make it more modern t use the non-dangerous filea access. Could someone help out to descibr how to do it?
I tried to add fileprovider but I'm not used to this so I should not continue wihtout some help first.
B4X:
#Region Project Attributes
#ApplicationLabel: asd
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private ImageView1 As ImageView
Private Button1 As Button
Private Button2 As Button
Dim onoff As Boolean
Private FileProvider As Object
Private CropFile As String
Private ActivityResult As Object
End Sub
Sub Activity_Create(FirstTime As Boolean)
Galeria(File.DirRootExternal, "1.jpg")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause
End Sub
Sub ParseUri(FileName As String) As Object
Dim r As Reflector
Return r.RunStaticMethod("android.net.Uri", "parse", Array As Object(FileName), Array As String("java.lang.String"))
End Sub
Sub Galeria(Directory As String, PictureName As String)
Dim i As Intent
onoff = True
i.Initialize(i.ACTION_PICK, "")
i.SetType("image/*")
i.PutExtra("output", ParseUri("file://" & File.Combine(Directory, PictureName)))
' i.PutExtra("output", FileProvider) ' Output URI using FileProvider
i.PutExtra("crop", "true") ' crop enabled
i.PutExtra("aspectX", 0) ' crop aspects
i.PutExtra("aspectY", 0)
i.PutExtra("outputX", 200) ' crop size
i.PutExtra("outputY", 150)
StartActivity(i)
End Sub