B4J Question Error in loadlayout

Chris Guanzon

Active Member
Licensed User
Longtime User
I have an error in loadlayout. I don't know what I'm missing.

Here's my code:

B4X:
Sub Show
    If MainForm.IsInitialized = False Then
        MainForm.Initialize("frm", 340, 280)
        MainForm.RootPane.LoadLayout("main1")
    End If
    MainForm.Show
End Sub

This is the error:

Waiting for debugger to connect...
Program started.
Connection: true
Error occurred on line: 47 (Main)
java.lang.ClassCastException: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to class java.lang.Class (sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl and java.lang.Class are in module java.base of loader 'bootstrap')
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:162)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:204)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:204)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:84)
at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:84)
at b4j.example.main._show(main.java:220)
at b4j.example.main$ResumableSub_AppStart.resume(main.java:169)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:136)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:85)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at anywheresoftware.b4a.keywords.Common$3.run(Common.java:1086)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
 

Chris Guanzon

Active Member
Licensed User
Longtime User
i uploaded the app. please see what is wrong with this. thanks in advance.
 

Attachments

  • Notification App Server.zip
    10.5 KB · Views: 118
Upvote 0

amykonio

Active Member
Licensed User
Longtime User
Hi.

If I comment:
B4X:
Private ComboBox1 As B4XView
Private ListView1 As B4XView
then your form loads without error.
Also if I change them to:
B4X:
    Private ComboBox1 As ComboBox
    Private ListView1 As ListView
It also works.
I'm not sure why this happens.
Maybe those controls cannot work as b4xview...

Andreas.
 
Last edited:
Upvote 0
Top