Android Question imagedownloader problem

Douglas Farias

Expert
Licensed User
Longtime User
hi all
i m using this code to download new images

B4X:
Sub atualizanaoenviadas
    CallSub(ImageDownloader, "ClearCache")
    Dim links As Map
    links.Initialize
      links.Clear
    links.Put(imgperfil, kv.GetSimple("imgsocial"))
    links.Put(imgn1, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"0.jpg")
    links.Put(imgn2, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"1.jpg")
    links.Put(imgn3, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"2.jpg")
    links.Put(imgn4, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"3.jpg")
    CallSubDelayed2(ImageDownloader, "Download", links)
End Sub

i call this on resume

the problem here is imgn1 2 3 and 4 dont change, i clean the cache every time i call this
but this dont change, the strange is imgperfil < this change o_O only this
why the anoters dont change too?
 

Douglas Farias

Expert
Licensed User
Longtime User
realy have new images but dont change have another way to remove?
i try

B4X:
Sub atualizanaoenviadas
    CallSub(ImageDownloader, "ClearCache")
    Dim links As Map
    links.Initialize
      links.Clear
imgn1.Bitmap = null
imgn2.Bitmap = null
imgn3.Bitmap = null
imgn4.Bitmap = null
    links.Put(imgperfil, kv.GetSimple("imgsocial"))
    links.Put(imgn1, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"0.jpg")
    links.Put(imgn2, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"1.jpg")
    links.Put(imgn3, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"2.jpg")
    links.Put(imgn4, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"3.jpg")
    CallSubDelayed2(ImageDownloader, "Download", links)
End Sub

and the imagens dont change too o_O
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
try something like

B4X:
Dim r As Int = Rnd(0,999999)
links.Put(imgn1, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"0.jpg?r="&r)
links.Put(imgn2, "http://10.10.10.10/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/Miniaturas/"&"1.jpg?r="&r)

this trick is used a lot in flash to get rid of caching problems.
 
Upvote 0
Top