Android Question Dim $ As Map => Question

Hirogens

Active Member
Licensed User
Longtime User
Hello, I use a Map to stock my long/lat. I do this like this
B4X:
If gmaps.IsInitialized Then
        gmaps.Put(Key, Round2(Location1.Latitude,5) & "," & Round2(Location1.Longitude,5))
        Log("Pos lat: " & Round2(Location1.Latitude,5) & " Pos long: " & Round2(Location1.Longitude,5))
        Key = Key + 1
    End If
I would like to stock in my map all the value by key (ex: key:1 = ... ; key:2 = ...) Actually it's stock randomly so how can I correct that ?
 

Cableguy

Expert
Licensed User
Longtime User
Then don't use a map... a map's main feature it that you don't need to know not search for an index to retrieve a value, just need to know the key.
To be able to set the order, then you need to use a list, but then things may get a bit tricky....
My suggestion would be to keep the map and create an array just to keep the maps key indexed...
 
Last edited:
Upvote 0
Top