Hi,
I want to run this code:
Function code:
imageClass code:
But, when I run it, activity stops.
I tested it with 3 photos, the code works fine, but when I use 4 photos, the problem appears.
I guess that it's because is long process, but I don´t know.
Thanks¡
I want to run this code:
Function code:
B4X:
Sub cargaImagenes
Dim lista As List
lista.initialize
Dim archivo As String
lista = File.ListFiles(Comun.fileDireError)
Dim left As Int : left = 10dip
Dim top As Int : top = 10dip
Dim columnas As Int : columnas = 1
For i = lista.Size-1 To 0 Step -1
archivo = lista.Get(i)
Dim imagen As imagenClass
imagen.Initialize(archivo)
If columnas > 3 Then
columnas = 1
top = top + 130dip
left = 10dip
End If
scroll.Panel.AddView(imagen.getImagen, left, top, 120dip, 120dip)
left = left + 130dip
columnas = columnas + 1
Next
End Sub
imageClass code:
B4X:
'Class module
Sub Class_Globals
Dim imagen As ImageView
Dim name As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(nombre As String)
imagen.Initialize("documento")
imagen.Bitmap = LoadBitmap(Comun.fileDireError, nombre)
name = nombre
End Sub
'Retorna la imagen del objeto
Sub getImagen As ImageView
Return imagen
End Sub
Sub documento_Click
Msgbox(name, "")
End Sub
But, when I run it, activity stops.
I tested it with 3 photos, the code works fine, but when I use 4 photos, the problem appears.
I guess that it's because is long process, but I don´t know.
Thanks¡