I have a complex layout, and before all was OK, but at some point, when the layout gots to be complex - the error is started to occur (non-crashing), at LoadLayout:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
dd.Initialize
'The designer script calls the DDD class. A new class instance will be created if needed.
'In this case we want to create it ourselves as we want to access it in our code.
xui.RegisterDesignerClass(dd)
Root.LoadLayout("MainPage") 'error - at this point
Waiting for debugger to connect...
Program started.
java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -4 is negative
at java.base/java.lang.System.arraycopy(Native Method)
at anywheresoftware.b4a.keywords.Bit.ArrayCopy(Bit.java:192)
at b4j.example.bitmapcreator._fillhorizontalline(bitmapcreator.java:4370)
at b4j.example.bitmapcreator._drawrect2(bitmapcreator.java:2583)
at b4j.example.bitmapcreator._drawrectrounded2(bitmapcreator.java:2686)
at b4j.example.bitmapcreator._drawcanvasasync(bitmapcreator.java:1663)
at b4j.example.bitmapcreator$1.run(bitmapcreator.java:5075)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Just posting the layout file is of no use at all. Post a small project that uses it and causes the error. Don't try to make,more work for us just to make it easier for you because we won't do it.
Small testing project - yes, always best variant. But this time - it's some internal non-crashing error - is it possible to debug it deeper than ... just trying lo LoadLayout ?
If yes, please, suggest.
I dot see how small project can help here. But i'm trying to prepare.
We can't just look inside a layout file, the content is binary data and is meaningless to read. Without a project to load it into the designer what do you expect us to do? Magic?
The problem appears to be with ProgressBar1. Delete and add it again. You should have been able to find this yourself by selectively deleting views and testing each time.
Yes. Save a layout file copy. Remove view, test, if error there copy layout file back, remove another view - rinse and repeat. Or do a binary chop. Remove half the views, then a quarter then finally one by one.