may you
should be using a list, if you don't mind the suggestion.
the problem with maps, in general, is that the order in which the items were entered is not maintained. so, technically, the "last" item in a map may not "be the
droid item you're looking for". in other words, you have no idea what the last item in a map is because of the way a map is structured. this may or may not be a problem for you. if you just want the "last" item in the map - regardless of what it is or when it was added to the map - and you don't have its key, then you have little choice but to find out how big the map is and to last for the last item:
' warning: deprecated code follows
dim count as int = map.size
dim value as string = map.getValueAt( count - 1)
' out of curiosity, if you wanted to get the last key while you're at it, you can add:
dim thekey as string = map.getKeyAt( count - 1)
if you used a list, the order would be maintained, and the last item in the list would be the most recently added. if that mattered to you.
all that said, i believe i read somewhere here that, in B4A, order is maintained. nevertheless, in this instance, since you don't know the key, you really have no choice but to acess the "last" item in a map with the code suggested here. stepping through all the entries to get to the last one, serves no particular purpose.
if you want to know why getkeyat() and getvalueat() are deprecated, you'll have to ask a higher authority.