Hi I have a question. Say I have a custom type and I make a map of object based on that custom type. then I use kvs to put that map to save it. when the app starts the map is restored by getting from the kvs collection. So far so good. no problem here.
now say I change the custom type and I need to add a list element to it. when I do the get from kvs of course the elements in kvs do not contain the new list elem to that is null of course so if try to inizialize the list I get " null receiver". is there a way to do that?
simplified example (not the real code)
now say I change the custom type and I need to add a list element to it. when I do the get from kvs of course the elements in kvs do not contain the new list elem to that is null of course so if try to inizialize the list I get " null receiver". is there a way to do that?
simplified example (not the real code)
B4X:
'version 1'
type test1(i as int, s as string)
private MyMap as map
'....
private testobj as test1
testobj.i = 1
testobj.s = s
''.....
MyMap.put(testobj,mykey)
....
kvs.put("MyMapKVS")
............
'when the app opens:'
MyMap = kvs.get("MyMapKVS")
'....get one element
private MyObj as test1
MyObj.initialize
MyObj = MyMap.get(Keyx)
....
' now in version 2 of the app I add the list'
type test1(i as int, s as string,l as list)
private MyMap as map
'....
'when the app opens:'
MyMap = kvs.get("MyMapKVS") 'MyMapKVS was saved in version 1 so the objects in do not have the list element
'....get one element
private MyObj as test1
MyObj.initialize
MyObj = MyMap.get(Keyx)
'here if I do '
MyObj.l.initialize 'here I get the null receiver error