Android Question APP crashes on LoadLayout

Moosi

Member
Licensed User
Longtime User
Hi,
after upgrading to B4A 6.8 I have a problem with loading a Layout File.
The Log says: Object should first be initialized (ScrollView).
I do not access the ScrollView in the code, I´m just loading the layout.
It worked in earlier Versions. I have the impression that the new B4A damaged the LayoutFile.
Is that possible?

Any Help is much appreciated.

An extracted Version of the App is attached, so maybe someone has an idea where the problem comes from.

That is the relevant Code:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("pgmain")
End Sub

The Error occurs on line 26 wich is the: Activity.LoadLayout("pgmain")

B4X:
Error occurred on line: 26 (Main)
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (ScrollView).
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at b4a.example.main.afterFirstLayout(main.java:102)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5476)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Object should first be initialized (ScrollView).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
    at anywheresoftware.b4a.objects.ViewWrapper.innerInitialize(ViewWrapper.java:71)
    at anywheresoftware.b4a.objects.ScrollViewWrapper.innerInitialize(ScrollViewWrapper.java:59)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:406)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:425)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:144)
    ... 21 more
** Activity (main) Resume **
 

Attachments

  • LoadLayout.zip
    90.3 KB · Views: 195

DonManfred

Expert
Licensed User
Longtime User
Where are all the objectdefinitions you set with the designer?

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
End Sub

Change it to

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private AppTitelLbl As Label
    Private ImLogo As ImageView
    Private KapitelCount As Label
    Private KapitelTitle As AutoTextSizeLabel
    Private LblLoeschenAll As Label
    Private PnlProgressBarTop As Panel
    Private PnlTopBar As Panel
    Private ScrollView1 As ScrollView
    Private StartImg As ImageView
    Private TopUIElement As Panel
End Sub
 
Upvote 0

Moosi

Member
Licensed User
Longtime User
Where are all the objectdefinitions you set with the designer?

they are not necessarily needed in that test case, thanks anyway.

I rebuild one layoutfile from scratch and tadaaa, it works.

Looks like 6.8 is doing something with the layoutfiles. I need to investigate further...
 
Upvote 0

Moosi

Member
Licensed User
Longtime User
Hmmm,
I used a custom-font for some Labels. In 6.8 the Field "Typeface" is left empty. After Changing it to DEFAULT or the custom-font, it works.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…