SMM is a really great and flexible tool. But I still can’t figure out how to save an image already downloaded to the Panel using SMM to disk. Please tell me how to do this.
Or will I have to download the same image a second time from the same link, now using HttpJob?
That is, I want to do the operation MediaManager.SetMediaFromFile, but only in reverse. Not from file to panel, but from panel to file. Is this possible?
Thank you for your time.
Or will I have to download the same image a second time from the same link, now using HttpJob?
That is, I want to do the operation MediaManager.SetMediaFromFile, but only in reverse. Not from file to panel, but from panel to file. Is this possible?
Thank you for your time.
B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private Pane1 As B4XView
Private MediaManager As SimpleMediaManager
End Sub
Public Sub Initialize
MediaManager.Initialize
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
Private Sub Button1_Click
MediaManager.SetMediaWithExtra(Pane1, "https://b4x-4c17.kxcdn.com/images3/code.png", "", CreateMap(MediaManager.REQUEST_CALLBACK: Me))
Wait For (Pane1) SMM_MediaReady (Success As Boolean, Media As SMMedia)
If Success Then
Log ("success")
Private j As HttpJob
j.Initialize("", Me)
j.Download("https://b4x-4c17.kxcdn.com/images3/code.png") 'download the same file from the same link again :(
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Private out As OutputStream = File.OpenOutput(File.DirApp, "01.png", False)
File.Copy2(j.GetInputStream, out)
out.Close
End If
Else
Log ("failure")
Return
End If
End Sub
Last edited: