Android Question [B4X] Treeview Structure with For Each

Alexander Stolte

Well-Known Member
Licensed User
Hey, this question is a general programming question.

My goal is a Treeview Structure.
I have the following Database Structure: id and parent_id

If parent_id = 0 Then it is a root item.

My considerations were a For Each loop

This is just pseudo code:
For Each id in table

If parent_id = 0 then

add item to list

For Each parent_id In id

if id = parent_id then

add item to second level

end if


End if

How would you solve such an assignment?