B4J Question Global variable (Map)

david13

Member
Licensed User
Hello All,

I am using the jobdone sub to store my list into map I could do it easely:

If list.Size - 1 <0 Then

Else


mapNombreDeCaisse.Put(tl.First,somestring)
End If
Msgbox.Show(mapNombreDeCaisse.size,"s")


//// I could see that the size was 13, but then when I wanted to use it in another function I could not find my data inside the map even if the variable is Global,

Any Help please, thanks
 

OliverA

Expert
Licensed User
Longtime User
I am using the jobdone sub to store my list into map I could do it easely:
B4X:
If list.Size - 1 <0 Then

Else


mapNombreDeCaisse.Put(tl.First,somestring)
End If
Msgbox.Show(mapNombreDeCaisse.size,"s")
Ok, there is a list named "list", but I don't see where you are storing the list in the map. In this case your storing "somestring" in the map that has an identifier of tl.First. So where is the list that is stored in the map?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
You need to provide some more code to get a definite answer. However as a guess:

The Keys in a map are objects, the types need to match to retrieve the values i.e.

B4X:
Dim M As Map
    M.Initialize
    M.Put("1","1")
   
    Log(M.Get(1))

will not work. While
B4X:
Dim M As Map
    M.Initialize
    M.Put("1","1")
   
    Log(M.Get("1"))

Will.
 
Upvote 0
Top