Android Question picture renewed everyday

Almora

Well-Known Member
Licensed User
Longtime User
hi

I am using this code and AX_RecyclerView lib.
I have a picture source that is renewed every day.
The picture from the application is not renewed every day. shows when I first installed the application. not showing the new picture the next day. not renewed. still showing the old picture. keeps pictures in memory. not renewed.
what can I do..



B4X:
Sub Globals
    Dim Recycler As AX_RecyclerView
    Dim Text As Label
       
End Sub

Sub Activity_Create(FirstTime As Boolean)
   
    Activity.LoadLayout("1")
   


    Recycler.Initializer("Amir").ListView.Build  
    Activity.AddView(Recycler,0,23%y,100%x,67%y)

    Dim Adapter As AX_RVAdapter
    Adapter.Initialize("Amir",Adapter.LOOP_NEVER)
   
    Recycler.Adapter=Adapter




End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Private Sub Amir_onCreateViewHolder (Parent As Panel,ViewType As Int)
    Dim Panel As Panel
    Panel.Initialize("")
    Parent.AddView(Panel,10dip,10dip,Parent.Width-20dip,135dip)

   
    Dim img As ImageView
   
    img.Initialize("")
    Panel.AddView(img,8dip,6dip,Panel.Width/3,Panel.Height - 10dip)

    Text.Initialize("")
    Panel.AddView(Text,Panel.Width/2 +10dip ,Panel.Height/2 - 10dip,(Panel.Width - (Panel.Width/3))-20dip,Panel.Height/2)
End Sub

Private Sub Amir_onBindViewHolder (Parent As Panel,Position As Int)
    Dim Panel As Panel = Parent.GetView(0)
    Dim ViewManager As Amir_ViewManager
    ViewManager.Initialize(Panel)
    ViewManager.BackgroundColor=Colors.RGB(211,211,211)
    ViewManager.BackgroundEnabledColor=Colors.RGB(211,211,211)
    ViewManager.Radius=0dip
    ViewManager.Start
    Panel.Elevation=2dip
    setClipToOutline(Panel)
   
    Dim img As ImageView = Panel.GetView(0)
    Dim  Text = Panel.GetView(1) As Label

    LoadImage(img,Position)
   

    Parent.Height=145dip
    'Parent.Width=100%x
End Sub

Private Sub Amir_GetItemCount As Int
    Return 2
End Sub

Public Sub setClipToOutline (Panel As Panel)
    Dim P As Phone
    If P.SdkVersion >= 21 Then
        Dim jo As JavaObject = Panel
        jo.RunMethod("setClipToOutline",Array(True))
    End If
End Sub


Private Sub LoadImage (Img As ImageView,Position As Int)
    Dim Glide As Amir_Glide
    Dim color2 As ColorDrawable
    color2.Initialize(Colors.DarkGray,0)
    Glide.RequestManager.SetDefaultRequestOptions(Glide.RO.ErrorDrawable(color2).Placeholder(color2).CenterCrop)
    Glide.Initializer.Default
   
   
    Select Case Position
        Case 0
            Glide.Load("https://xxxx-thumb1.jpg").Apply(Glide.RO.FitCenter).Into(Img)
        Case 1
            Glide.Load("https://yyyy-thumb2.jpg").Apply(Glide.RO.FitCenter).Into(Img)

    End Select
       
  
End Sub



  Private Sub Amir_onItemClick (Parent As Panel,Position As Int)
               
   End Sub
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
You are using glide. Glides stores internally the image cache so it will load faster next time and also it will load if the image Is no longer there.

Unfortunately I don't know the library but look for the word cache among the properties
 
Upvote 0
Top