B4A Class Grid Class, easy and fast grid

Hello,

I would like to share with all people a small Class code.
Together we can keep improving code and to have a quick and easy to use.

Images are via URL using the #AdditionalJar: picasso-2.5.2, can you read more about that in https://www.b4x.com/android/forum/t...onaljar-and-javaobject-picasso.40904/#content

thanks

Screenshot_20160928-122054.png
 

Attachments

  • gridclass.zip
    64.8 KB · Views: 546
  • gridclass1.0.zip
    65.1 KB · Views: 584
Last edited:

scsjc

Well-Known Member
Licensed User
Longtime User
Hello,

I have a problem with a to much images... the memory is full and can display the images.....
in video can view the problem..... thanks for help !!!!

 

scsjc

Well-Known Member
Licensed User
Longtime User
I put a new version 1.0 with a load images on demand (with scrolldown).....
now the class don't have error memory with a lot images.

i change/add this code:

B4X:
Sub sv_ScrollChanged(index As Int)
    'Log(index)
    Dim fila As Int= (Round((index/altopanel)))+1
    Dim ivb As Int = fila*2
    Dim iva As Int = ivb-1

    For a=0 To 4
        If iva+a < totalregistros Then
            If iv(iva+a).IsInitialized Then
                If iv(iva+a).Visible=False Then cargaimagen(iva+a)
            End If
        End If
        If ivb+a < totalregistros Then
            If iv(ivb+a).IsInitialized Then
                If iv(ivb+a).Visible=False Then cargaimagen(ivb+a)
            End If
        End If
    Next
End Sub

Sub cargaimagen(indice As Int)
    GetPicasso.RunMethodJO("load", Array(imagenurl.Get(indice-1))).RunMethodJO("resize", Array(180, 180)).runmethodjo("skipMemoryCache",Null).RunMethodJO("centerCrop", Null).RunMethodJO("into", Array(iv(indice)))

    iv(indice).Visible=True
    GetPicasso.RunMethodJO("invalidate", Array(imagenurl.Get(indice-1)))

    iv(indice).Bitmap=Null
    iv(indice).SetBackgroundImage(Null)
    iv(indice).Invalidate
End Sub

but if somebody have more nice solution, please tell me
thanks!!!
 

Attachments

  • gridclass1.0.zip
    65.1 KB · Views: 457
Last edited:
Top