Android Question [Solved] RandomAccessFile WriteB4XObject Problem

Discussion in 'Android Questions' started by fixit30, Apr 7, 2015.

  1. fixit30

    fixit30 Active Member Licensed User

    Dear All.

    This is my first ever question on this forum as I have always managed to find the answer using the wealth of knowledge from previous questions so please be gentle with me!

    From this thread: http://www.b4x.com/android/forum/threads/b4xobject-b4a-b4j-b4i-objects-serialization.48272/#content

    Erel Says:

    I have created a Custom Type, however I get the following error when I call raf.WriteB4XObject

    Code:
    java.lang.RuntimeException: java.lang.RuntimeException: Cannot serialize object: (ArrayList) [123]
    If I use WriteObject or WriteEncryptedObject it works fine.

    I believe this issue is related to my Custom Type containing a List.

    Is this behaviour normal?

    Attached is a very simple Sample Project which shows the problem.

    Many Thanks.

    Alan.

    Edit: Also, in case it matters.

    B4A Version: 4.30
    RandomAccessFile Version: 2.00
     

    Attached Files:

    Last edited: Apr 7, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is indeed a bug related to the List inside the type. It is fixed for the next versions.
     
  3. fixit30

    fixit30 Active Member Licensed User

    Hi Erel.

    Many thanks for your confirmation of this issue.

    Are you able to tell me when the next version will be available?

    Regards.

    Alan.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    The updated library is attached.
     

    Attached Files:

    DonManfred, Peter Simpson and fixit30 like this.
  5. fixit30

    fixit30 Active Member Licensed User

    Thank you Erel for your speedy response. The updated library works perfectly. :D

    The performance increase of WriteB4XObject is very noticeable and has made a big difference to my app!
     
    Peter Simpson, Erel and DonManfred like this.
  6. MrKim

    MrKim Active Member Licensed User

    I, too am seeing this problem, I have a map with a type.
    Code:
    Dim MOL As Map
    Type LOL(Sort As  Int, Fname As String, SWL As CustomListView)
        MOL.Initialize
        
    Dim Lol As LOL
        Lol.Initialize
        Lol.Fname = 
    "SwipeList.swl"
        Lol.Sort = 
    1
        Lol.SWL = SwipeList
        MOL.Put(
    "SwipeList", Lol)
        MOL.Put(
    "ActiveZXZX", Lol)
        
    Dim Lol2 As LOL
        Lol2.Fname = 
    "Trash.swl"
        Lol2.Sort = 
    2
        Lol2.SWL = Trash
        MOL.Put(
    "Trash", Lol2)
        
    Dim Lol3 As LOL
        Lol3.Fname = 
    "Trash.swl"
        Lol3.Sort = 
    2
        Lol3.SWL = Trash
        MOL.Put(
    "Archive", Lol3)

        
    Dim R As RandomAccessFile

            
    File.Delete(File.DirInternal, "MOLZXZX")
            R.Initialize(
    File.DirInternal, "MOLZXZX"False)
            R.WriteB4XObject(MOL, 
    0)
    I am guessing it is the CustomListView in the type?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice