B4J Question [BANAno]: [SOLVED] Returning all list items in For Each

Mashiane

Expert
Licensed User
Longtime User
Hi there

I'm creating an event adder for my code with a list dependency..

B4X:
Dim nl As List
    nl.Initialize
    nl.AddAll(Array As String("anele", "is", "enjoying", "banano"))
    For Each strname As String In nl
        Dim strA As String = "Test-" & strname
        Log(strA)
        Log(strname)
    Next

A rather tricky one, the Log(strname) is able to log each item in the console yet, Im getting all the array items for logging strA whereas perhaps its just supposed to be each item appended to "Test-"

B4X:
Test-anele,is,enjoying,banano

AddAllSplit.png


I' m going to explore using the counter type of loop so long.

Update:

I see now where my issue is, this works when the items are added like this to the list..

B4X:
Dim nl As List
    nl.Initialize
    nl.Add("anele")
    nl.Add("is")
    nl.Add("enjoying")
    nl.Add("banano")

Will update my code for all AddAll so long..
 

Attachments

  • AddAllSplit.zip
    1.6 KB · Views: 294
Last edited:
Top