I would like to know if there is some easy way to save a map inside a file, and to be able to "preload" that map from the file, until the images are updated?
I use the map with the following code to keep in memory the bitmaps loaded from url:
Thanks
I use the map with the following code to keep in memory the bitmaps loaded from url:
B4X:
Sub Process_Globals
Public cache As Map
End Sub
Sub Service_Create
cache.Initialize
End Sub
public Sub Downloadimage(link As String, iv As ImageView)
If cache.ContainsKey(link) Then
Dim bmp As B4XBitmap = cache.Get(link)
If bmp.IsInitialized Then iv.SetBackgroundImage(bmp.Resize(iv.Width,iv.Height,True))
Else
Dim job As HttpJob
job.Initialize("", Me)
job.Download(link)
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
Try
Dim bmp As B4XBitmap = job.GetBitmap
cache.Put(link, bmp)
iv.SetBackgroundImage(bmp.Resize(iv.Width,iv.Height,True))
Catch
log(LastException)
End Try
End If
job.Release
End If
End Sub
Thanks