Android Question B4XBitSet

Philip Prins

Active Member
Licensed User
Longtime User
I like this feature in B4XCollections.

How can i store and retrieve the complete B4XBitset in a file or database?

Regards
Philip
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You will need to extract the data into an array of objects:
B4X:
Sub BitSetToArray (set As B4XBitSet) As Object()
    Dim o(set.Size) As Object
    For i = 0 To set.Size - 1
        o(i) = set.Get(i)
    Next
    Return o
End Sub

Sub ArrayToBitSet(o() As Object) As B4XBitSet
    Dim set As B4XBitSet
    set.Initialize(o.Length)
    For i = 0 To set.Size - 1
        set.Set(i, o(i))
    Next
End Sub

This array can be serialized with B4XSerializator (RandomAccessFile library).
 
Upvote 0
Top