B4J Question ConvertObjectToBytes (why does this give a java error?)

Marc De Loose

Member
Licensed User
Longtime User
The First gives no error but if change the code to the last it gives a Java Error.
I am confused.

B4X:
'===========> this gives NO ERROR
        For i=1 To All_lst_xRotateKnobs.Size-1
            Private ToAdd As xRotateKnobsCollectionType_NEW = All_lst_xRotateKnobs.Get(i)
            testlist.Add(ToAdd)
        Next

        ObjBytes =  ser.ConvertObjectToBytes(testlist)
        
'===========>' this does give JAVA ERROR object should first be initialized (list)       
        ObjBytes =  ser.ConvertObjectToBytes(All_lst_xRotateKnobs)
 

Marc De Loose

Member
Licensed User
Longtime User
Because of your question I looked at the logs and realized I had a bug somewhere that did not initialize a list that was part of the first element . I corrected that and now it passes.

To answer your question 3. The first element should be skipped by design. (I know that in the failing code it is included but that will be handled when reloading ).

Thx for activating my thoughts.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…