I'm using MQTT. I created the type shown below that contains a string array. I load this array and publish it to MQTT successfully but when I subscribe to the message and try to use the serializator I get the error message shown below. Do I need convert the string to an object or vice versa?
error: java.lang.RuntimeException: java.lang.IllegalArgumentException: field dickddomain.com.Proximate.main$_profilestuff.Ques has type java.lang.String[][], got java.lang.Object[]
B4X:
Type ProfileStuff(Desc As String, Picture() As Byte, Ques(31,36) As String)
Dim ProfileIn as ProfileStuff
.....
ProfileIn.initialize
....
Private Sub mqtt_MessageArrived (Topic As String, Payload() As Byte)
Dim obj as object
obj = serializator.ConvertBytesToObject(Payload)
' error occurs here
Hi, i use exactly the same last line, which produces the error, for more than two years - so i believe, the problem is, how you send the object.
We cant see, how you do this; maybe you should transfer your string array to an object (if possible) and send this object. Than the receive of an object should work too.
Hi, i use exactly the same last line, which produces the error, for more than two years - so i believe, the problem is, how you send the object.
We cant see, how you do this; maybe you should transfer your string array to an object (if possible) and send this object. Than the receive of an object should work too.
I've tried converting to an object. I get this error: java.lang.RuntimeException: java.lang.IllegalArgumentException: field dickddomain.com.Proximate.main$_profilestuff.Ques has type java.lang.Object[][], got java.lang.Object[].
Notice the difference in the number of brackets (dimensions) sent [][] vs. got []. After a lot of experimenting I think I understand now that Types are limited to a 1 dimensional array.
I'd like to know if anyone has gotten Types to work with multidimensional arrays.
I spoke too soon. This still is not working. After a lot of research I finally discovered that arrays are not allowed in type variables. You can have arrays OF type variables not arrays IN type variables. It's as simple as that. I just wish that had been stated clearly in the documentation on this subject.