iOS Question Crash - no logs exception

voxel

Member
Licensed User
Hi,

I have an app using B4i (with B4xpages) and randomly, it crashes when displaying a list (around 1000 elements). I put try/catch and in debug, I have no log/exception. I put: B4XPages.GetManager.LogEvents = True.

Do you have any ideas on how I can capture the error causing this crash?
Thanks for your help.
 

voxel

Member
Licensed User
Yes, i am loading 1000 images (between 2kb and 8kb each image).

The list is a "CustomListView" + "CreateListItem"

Is the solution to reduce the size of the images? put in a vector format?
Is there a way to force the memory to be freed when the list is no longer displayed?

Here is an extract of the code with a Select (on 1000 lines) to build the list.

Thank.
B4X:
        Select resultat.GetInt("etat")
            Case 1
                ListAnalyse.Add(CreateListItem(DateFR(resultat.GetString("dateprel"))&amont,"  "&resultat.GetString("heureprel")&affpest,"vert.png",ListAnalyse.AsView.Width, 70dip),resultat.GetInt("rowid"))
            Case 6
                ListAnalyse.Add(CreateListItem(DateFR(resultat.GetString("dateprel"))&amont,"  "&resultat.GetString("heureprel")&affpest,"verti.png",ListAnalyse.AsView.Width, 70dip),resultat.GetInt("rowid"))
            Case 2,3
                If resultat.GetString("plvconformitebacterio")="N" Or resultat.GetString("plvconformitechimique")="N" Then
                    ListAnalyse.Add(CreateListItem(DateFR(resultat.GetString("dateprel"))&amont,"  "&resultat.GetString("heureprel")&affpest,"orange.png",ListAnalyse.AsView.Width, 70dip),resultat.GetInt("rowid"))
                Else
                    ListAnalyse.Add(CreateListItem(DateFR(resultat.GetString("dateprel"))&amont,"  "&resultat.GetString("heureprel")&affpest,"jaune.png",ListAnalyse.AsView.Width, 70dip),resultat.GetInt("rowid"))
                End If
            Case 4
                ListAnalyse.Add(CreateListItem(DateFR(resultat.GetString("dateprel"))&amont,"  "&resultat.GetString("heureprel")&affpest,"bebe.png",ListAnalyse.AsView.Width, 70dip),resultat.GetInt("rowid"))
            Case 5
                ListAnalyse.Add(CreateListItem(DateFR(resultat.GetString("dateprel"))&amont,"  "&resultat.GetString("heureprel")&affpest,"interdit.png",ListAnalyse.AsView.Width, 70dip),resultat.GetInt("rowid"))
            Case 0
                ListAnalyse.Add(CreateListItem(DateFR(resultat.GetString("dateprel"))&amont,"  "&resultat.GetString("heureprel")&affpest,"gris.png",ListAnalyse.AsView.Width, 70dip),resultat.GetInt("rowid"))
        End Select
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should implement lazy loading and add and remove items as they become visible or invisible.


And best to use SMM for the images: https://www.b4x.com/android/forum/t...rk-for-images-videos-and-more.134716/#content
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…