I am trying to set data for a B4XTable. The following must have a coding issue.
The first time through the loop, xxx array has the correct data. the second iteration (np=2) the yyy array is correct. However, the xxx array is not the same as the yyy array.
I must be missing something basic. I added separate string arrays for debugging. Otherwise, I would have coded data.add(data_item) at the end of the loop.
The first time through the loop, xxx array has the correct data. the second iteration (np=2) the yyy array is correct. However, the xxx array is not the same as the yyy array.
I must be missing something basic. I added separate string arrays for debugging. Otherwise, I would have coded data.add(data_item) at the end of the loop.
B4X:
Dim pos As Int = 0
Dim data_item(21) As String
Dim xxx() As String
Dim yyy() As String
Dim zzz(21) As String
For np = 1 To Main.num_players
pos = 0
data_item(pos) = players_scores(np).name
For nn = 1 To 9
pos = pos + 1
data_item(pos) = players_scores(np).score(nn)
Next
pos = pos + 1
data_item(pos) = players_scores(np).front
For nn = 10 To 18
pos = pos + 1
data_item(pos) = players_scores(np).score(nn)
Next
pos = pos + 1
data_item(pos) = players_scores(np).back
If np=1 Then
xxx = data_item
End If
If np=2 Then
yyy = data_item
End If
Next
Dim data As List
data.Initialize
data.Add(xxx)
data.Add(yyy)