Android Question B4Xtable was working fine but now doesn't display the data

Kevin Hartin

Active Member
Licensed User
Longtime User
Hi,

I had a working B4a App that used B4Xtables to display data taken from a web API and locally from a stored list. Everything was working fine until I started tweaking for a B4i version of the app.

As I was making the necessary changes for B4i, it was actually working insofar as the page it lands on that has the B4Xtable, was displaying properly, but as I started to make further B4i tweaks, the display of the rows stopped and all I see is a header in the B4a app, as follows.
download.jpg

The code to create this table is as follows;
B4Xtable:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    notifyTable.Initialize(Me,"notifyTable")
    notifyTable.HeaderFont = xui.CreateDefaultBoldFont(12)
    notifyTable.HeadersHeight = 25dip
    notifyTable.AddColumn("Date", notifyTable.COLUMN_TYPE_TEXT).InternalSortMode = "DESC"
    notifyTable.AddColumn("Title", notifyTable.COLUMN_TYPE_TEXT)
    notifyTable.AddColumn("Body", notifyTable.COLUMN_TYPE_TEXT)
    notifyTable.AddColumn("ID", notifyTable.COLUMN_TYPE_TEXT)
    Log("Notification Cols: "&notifyTable.Columns.Size)
    notifyTable.VisibleColumns.RemoveAt(3)
    showNotifications
End Sub

Private Sub showNotifications
    Dim formattedList As List
    formattedList.Initialize
    Dim l As List
    Dim m As Map
    Dim B4XSerializator1 As B4XSerializator
#if B4a
    Dim data() As Byte = File.ReadBytes(File.DirInternal, "notifications.list")
#else if b4i
    Dim data() As Byte = File.ReadBytes(File.DirDocuments, "notifications.list")
#End If
    l = B4XSerializator1.ConvertBytesToObject(data)
    Main.notifications = l
    Log(l.Size&" notifications")
    Dim i As Int = l.Size - 1
    For Each m As Map In l
        Dim sDate As String = m.Get("Date")
        Dim sTitle As String = m.Get("Title")
        Dim sBody As String = m.Get("Body")
        formattedList.Add(Array As String(sDate, sTitle, sBody))
        Log("notifications: "&formattedList.Size&"|"&sDate&"|"&sTitle&"|"&sBody)
        i = i - 1
    Next
    notifyTable.SetData(formattedList)
    Log("notifyTable: "&notifyTable.Size)
End Sub

Private Sub refresh
    Log("refresh")
    notifyTable.clear
    notifyTable.AddColumn("Date", notifyTable.COLUMN_TYPE_TEXT).InternalSortMode = "DESC"
    notifyTable.AddColumn("Title", notifyTable.COLUMN_TYPE_TEXT)
    notifyTable.AddColumn("Body", notifyTable.COLUMN_TYPE_TEXT)
    notifyTable.AddColumn("ID", notifyTable.COLUMN_TYPE_TEXT)
    notifyTable.VisibleColumns.RemoveAt(3)
    showNotifications
End Sub

as can be seen, there is a bit of logging going on to check the data and list sizes and table size, producing the following log output;
Logs:
*** notify: B4XPage_Created [mainpage]
Notification Cols: 4
10 notifications
notifications: 1|25/02/2026 14:51:43|signless unreturnable gamesman |encases lactogenic unlustful analogous unqueen tumid codifiability duodecimo classicists ARM
notifications: 2|25/02/2026 15:28:47|recodifying mutuality obtusifid |partizan embryopathology antifertility squirreling invertibrates malacopod reglazed informant's jingled trophies
notifications: 3|26/02/2026 14:19:33|uninceptively trustihood Heins |swan-upping Pestalozzian undrained otarine nontesting apronful agendum Anti-fascist avalent congregating
notifications: 4|09/03/2026 12:45:03|Khosa befool well-armored |lycanthrope signficantly transmogrify rere-supper structive unsaintly Urbas formication chevaux-de-frise gowd
notifications: 5|09/03/2026 15:27:10|Index|k91eheva9k474ountggchmvoc0
notifications: 6|09/03/2026 15:27:24|Index|k91eheva9k474ountggchmvoc0
notifications: 7|09/03/2026 15:27:59|Index|k91eheva9k474ountggchmvoc0
notifications: 8|09/03/2026 15:28:22|Index|k91eheva9k474ountggchmvoc0
notifications: 9|09/03/2026 15:29:23|Index|k91eheva9k474ountggchmvoc0
notifications: 10|09/03/2026 15:34:54|Index|k91eheva9k474ountggchmvoc0
[B]notifyTable: 0[/B]
*** mainpage: B4XPage_Disappear [mainpage]
*** notify: B4XPage_Appear [mainpage]
** Activity (main) Resume **
refresh
10 notifications
notifications: 1|25/02/2026 14:51:43|signless unreturnable gamesman |encases lactogenic unlustful analogous unqueen tumid codifiability duodecimo classicists ARM
notifications: 2|25/02/2026 15:28:47|recodifying mutuality obtusifid |partizan embryopathology antifertility squirreling invertibrates malacopod reglazed informant's jingled trophies
notifications: 3|26/02/2026 14:19:33|uninceptively trustihood Heins |swan-upping Pestalozzian undrained otarine nontesting apronful agendum Anti-fascist avalent congregating
notifications: 4|09/03/2026 12:45:03|Khosa befool well-armored |lycanthrope signficantly transmogrify rere-supper structive unsaintly Urbas formication chevaux-de-frise gowd
notifications: 5|09/03/2026 15:27:10|Index|k91eheva9k474ountggchmvoc0
notifications: 6|09/03/2026 15:27:24|Index|k91eheva9k474ountggchmvoc0
notifications: 7|09/03/2026 15:27:59|Index|k91eheva9k474ountggchmvoc0
notifications: 8|09/03/2026 15:28:22|Index|k91eheva9k474ountggchmvoc0
notifications: 9|09/03/2026 15:29:23|Index|k91eheva9k474ountggchmvoc0
notifications: 10|09/03/2026 15:34:54|Index|k91eheva9k474ountggchmvoc0
[B]notifyTable: 10[/B]

Another thing is when the showNotifications sub is run for the first time from the B4XPage_Created sub, it recognises the list has 10 items and the formattedlist also has 10 items, but when added to the notifyTable the table has Zero rows. When the refresh sub is run by the B4XPage_Appear sub the notifyTable shows 10 rows. If I remove the notifyTable.AddColumn from the B4XPage_Created sub and leave it to the B4XPage_Appear sub, the notifyTable again shows zero rows.

The B4i app doesnt even show the header of the table, but that is for another post once I get this B4a app working again.
download.jpg

Finally, when I go back to a working backup of the B4a app and I compare the code relating to the notifyTable, they are exactly the same.
download.jpg

Any help greatly appreciated,

Kev
 
Top