Android Question Remove CLV wihout lose index

devmobile

Active Member
Licensed User
Hello
I created Treeview with Customlistview
Everything is fine (Select node and show sub nodes)
But i need to close Node
I remove all node exist in clicked node
But when i remove index 4 from list,unfortunately get error because not exist index for remove
Example i have 4 item
When i remove item with index 3 and remove index 4 ,it get error because dont exist item with relate index
 

udg

Expert
Licensed User
Longtime User
When you remove an item, the index is modified for the remaining items.
If you need to remove one item at time, remove item(0) and loop until the list is empty.
Otherwise use CLV.Clear to emtpy the CLV in one shot.
 
Upvote 0

devmobile

Active Member
Licensed User
When you remove an item, the index is modified for the remaining items.
If you need to remove one item at time, remove item(0) and loop until the list is empty.
Otherwise use CLV.Clear to emtpy the CLV in one shot.
Thanks
 
Upvote 0
Top