Android Question Receive and save photos

SMOOTSARA

Active Member
Licensed User
Longtime User
Hi guys 🌹

I receive a photo from the Url at "b4xmainpage"
And put it in imageview in one

B4X:
Sub DownloadAndSetImage(Url As String, iv As ImageView)
    Log("♥♥♥♥♥♥♥♥♥♥  DownloadAndSetImage ♥♥♥♥♥♥♥♥♥♥♥♥♥♥")
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(Url)
    Wait For (j) JobDone (j As HttpJob)
    If j.Success Then
        Try
            'the item might have already been removed
            If iv.IsInitialized Then
                Wait For (BitmapsAsync1.LoadFromHttpJob(j, iv.Width, iv.Height)) Complete (bmp As B4XBitmap)
                If bmp.IsInitialized And iv.IsInitialized Then
                    iv.Bitmap = bmp
                    iv.Gravity = Gravity.Fill
                End If
            End If
        Catch
            Log(LastException)
        End Try
    End If
    j.Release

End Sub



I want to use this photo in different places, for example on the "masterpage" B4Xpage and on the "exitpage" B4Xpage


How do I save it and use it in other B4Xpage?
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
Check Okhttputils link. Look through the examples. There is an example on downloading image and saving it.
So, you can save the image and load it anytime into your imageview

 
Upvote 0
Top