iOS Question UnReadOnly Map.IsReadOnly?

You will need to copy the map. You can do it manually or use B4XSerializator (iRandomAccessFile library)
Code: Copy
Sub CopyMap(m As Map) As Map
   Dim ser As B4XSerializator
   Return ser.ConvertBytesToObject(ser.ConvertObjectToBytes(m))
End Sub
Thanks a lot, thought of such and had already written a loop function. This will do..
 
Upvote 0
You will need to copy the map. You can do it manually or use B4XSerializator (iRandomAccessFile library)
Code: Copy
Sub CopyMap(m As Map) As Map
   Dim ser As B4XSerializator
   Return ser.ConvertBytesToObject(ser.ConvertObjectToBytes(m))
End Sub
I had done this...

Code: Copy
Sub UnReadOnlyMap(sourceMap As Map) As Map
    ' copy a map to a new map to make it IsReadOnly = False
    If sourceMap.IsReadOnly = False Then Return sourceMap
    ' the map is readonly, convert it
    Dim newMap As Map
    newMap.Initialize
    ' copy each map item
    For Each key As String In sourceMap.Keys
        Dim val As Object = sourceMap.Get(key)
        newMap.Put(key,val)
    Next
    Return newMap
End Sub
 
Upvote 0
Back
Top