Android Question listview & lists

merlin2049er

Well-Known Member
Licensed User
Longtime User
Hi, I've got strings in a listview that I'd like to roll back (undo)

I've kind of got the figured out- works well.

B4X:
 listview1.RemoveAt(listview1.size -1)

I've also set up lists to individually hold individual temp items from that string...

B4X:
' remove last entry from temp list
tempp1score.RemoveAt(tempp1score.size -1)

'assign the last item from temp to current score
player1score = tempp1score.Get(tempp1score.size -1)

I get ArrayindexarrayoutofboundsExecption: length=12; index = -1

Maybe I've just got to use a condition not to exceed the index?
 

NJDude

Expert
Licensed User
Longtime User
Instead of using the SIZE you should be using the POSITION, I'm assuming that you are removing the item in the ItemClick event, if not, then save the position in a Global variable.

One last thing, ListView items are ZERO indexed.
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
No, I'm not touching the listview. I've got an undo button, that rolls back the listview fine.

It's the lists that are giving me grief.
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
Argh, had a tough time with arrays and lists tonight. I'll give it a ago tomorrow.

Or save that feature for the paid version.
 
Upvote 0
Top