Does anyone have a code snippet that would make it simple to download a url to a specific file, asyncronously, while auto handling queueing. While throwing an event on the main activity and letting it know which file is done downloading?
Basically, is there any way to do this:
I want to do something like this so that I can just call the download sub whenever I need to download a file, without having to worry if the previous download has been completed. It would also simplify the need to track which files are currently downloading.
I've seen examples very simmilar to this, but they never let me specify the download directory or filename, and the callback was a general 'Hey, I'm done!', not 'Hey, testimage.png is ready to load... gimme a minute to get the other two done'.
Any Suggestions?
Basically, is there any way to do this:
B4X:
If File.Exists(SaveFileName) = False then
Something.DownloadFile(FileURL, File.DefaultRootExternal, SaveFileName)
Activity.Background = LoadBitmap(File.DirAssets, "Placeholder.png")
Else
Activity.Background = LoadBitmap(File.DefaultRootExternal, SaveFileName)
End If
Sub Download_finish(Filename as String)
Activity.Background = LoadBitmap(File.DefaultRootExternal, Filename)
end sub
I want to do something like this so that I can just call the download sub whenever I need to download a file, without having to worry if the previous download has been completed. It would also simplify the need to track which files are currently downloading.
I've seen examples very simmilar to this, but they never let me specify the download directory or filename, and the callback was a general 'Hey, I'm done!', not 'Hey, testimage.png is ready to load... gimme a minute to get the other two done'.
Any Suggestions?