I am trying to send a custom type object that contains a map using the B4XSerializer thing.
But I keep getting this error:
java.lang.RuntimeException: java.lang.RuntimeException: This method does not support arrays of primitives.
Here is the code:
B4X:
Dim DataPacket As StatCommand
DataPacket.Initialize
DataPacket.Command = "RosterInfo" 'Sending roster tables only.
Dim RosterMap As Map
RosterMap.Initialize
RosterMap.Put("HomeRoster", HomeRoster)
RosterMap.Put("GuestRoster", GuestRoster)
RosterMap.Put("PlayersOnCourt", PlayersOnCourt)
DataPacket.Data = RosterMap
If Remote1Status = 3 Then 'Send roster tables to stat remote 1.
If AstreamRemote.IsInitialized = True Then AstreamRemote.Write(ser.ConvertObjectToBytes(DataPacket))
End If
If Remote2Status = 3 Then 'Send roster tables to stat remote 2.
If AstreamRemote2.IsInitialized = True Then AstreamRemote2.Write(ser.ConvertObjectToBytes(DataPacket))
End If
Read the documentation: The following types are supported: Lists, Arrays of bytes and Arrays of objects, Maps, Strings, primitive types and user defined types.
As the error message says, arrays of primitives (except of bytes) are not supported.
Use an array of objects instead, or better use a List.
I dont even know what a primitive is. Googling it didnt really help either. As I have mentioned in the past, I came from VB6 land where none of that existed.