D
Deleted member 103
Guest
Hi,
I have a general problem with reading the list of map.
error= java.lang.ClassCastException: java.lang.String
Here is my code:
I have a general problem with reading the list of map.
error= java.lang.ClassCastException: java.lang.String
Here is my code:
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim map1,map2 As Map
Dim list1 As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
map1.Initialize
map2.Initialize
list1.Initialize
list1.AddAll(Array As String("1","2","3","4"))
map1.Put("list1",list1)
File.WriteMap(File.DirDefaultExternal,"test.map",map1)
map2=File.ReadMap(File.DirDefaultExternal,"test.map")
Dim lst As List
lst.Initialize
lst=map2.GetValueAt(0)
'lst.AddAll(Array As String(map2.GetValueAt(0)))
Dim Nr As Int
For i = 0 To lst.Size -1
Nr=lst.Get(i)
Log("Nr=" & Nr)
Next
End Sub