Android Question custom view error during release build, not debug

RichyK68

Active Member
Licensed User
Longtime User
Hi,

When I'm running and testing in Debug mode everything works fine. When I build to release I get this:


It is due to the custom view I am using on the layout.

What am I doing wrong?

Thanks,

Richard
 

RichyK68

Active Member
Licensed User
Longtime User
Hi,

Sure thing! I just knocked this up in a couple of minutes. Works in debug, crashes in release.

Maybe I'm doing something wrong ...

Richard
 

Attachments

  • customviewtest.zip
    9.5 KB · Views: 290
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The problem is here:
B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
   mBase = Base
   Base.LoadLayout("MyCustomView")
       
End Sub
You cannot load a layout file while the current layout file is loaded. The solution is simple.
Change it to:
B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
   mBase = Base
   Sleep(0)
   Base.LoadLayout("MyCustomView")
End Sub
This way the second layout will be loaded after the first one completed.
 
Upvote 0

RichyK68

Active Member
Licensed User
Longtime User
Hi Erel, thanks for the reply, which library would Sleep be in? I currently get:

B4A version: 6.31
Parsing code. Error
Error parsing program.
Error description: Undeclared variable 'sleep' is used before it was assigned any value.
Occurred on line: 23 (MyCustomView)
Sleep(0)

Richard
 
Upvote 0