Android Question [Solved]Error: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

When I attempt to switch from main to another activity app crashes

here's the error...
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (routes) Create, isFirst = true **
Error occurred on line: 65 (routes)
java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at b4a.example.routes._activity_create(routes.java:373)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at b4a.example.routes.afterFirstLayout(routes.java:104)
    at b4a.example.routes.access$000(routes.java:17)
    at b4a.example.routes$WaitForLayout.run(routes.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:407)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:453)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
    ... 18 more
** Activity (routes) Resume **
[/]
not sure what I did wrong. Any help would be much appreciated.
 

Xicu

Active Member
Licensed User
Longtime User
Allow me a litle suggestion ;) . Change the thread title "Error" to be useful for other users. For example "[Solved]Error: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType" o something similar.

The thread title should summarize the question. See
 
Last edited:
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Looking at the title of the thread you will see 3 dots on the right side of the screen.
There you will find Edit Thread option that will allow you to modify the title. ;)
Use it even to add something like [SOLVED] at the beginning of the title when you receive the information that solve your question/problem.
 
Upvote 0
Apparently, I'm just not cut out for this. That is were I speculated it would be. One last attempt here I click the the dots on the right side and create poll is the only option I have in the drop down menu. I even searched in page to make sure I wasn't missing them I click edit under the post and I still can't alter it. I am starting to just think I'm blind or stupid. I do appreciate everyone's help with what seemingly should be right in front of my face.
 
Upvote 0

Xicu

Active Member
Licensed User
Longtime User
Looking at the title of the thread you will see 3 dots on the right side of the screen.
There you will find Edit Thread option that will allow you to modify the title. ;)
Use it even to add something like [SOLVED] at the beginning of the title when you receive the information that solve your question/problem.
Captura.PNG


šŸ˜… Remember first authenticate you
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Apparently, I'm just not cut out for this. That is were I speculated it would be. One last attempt here I click the the dots on the right side and create poll is the only option I have in the drop down menu. I even searched in page to make sure I wasn't missing them I click edit under the post and I still can't alter it. I am starting to just think I'm blind or stupid. I do appreciate everyone's help with what seemingly should be right in front of my face.
Don't worry.
You just need to get used to it. ;)
 
Upvote 0
Top