Android Question CustomListView declared with the wrong type.

yaniv hanya

Active Member
Licensed User
I built part of the project into a separate project where I use the CustomListView XUI lib and everything works smoothly.
But when I copied the files to the big project and I try to run the screens from the small project the app crashes.
And I get this log:
Error occurred on line: 64 (MainImg)
java.lang.RuntimeException: java.lang.RuntimeException: Field mainimgclv1 was declared with the wrong type.
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at b4a.example.mainimg._activity_create(mainimg.java:455)
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.mainimg.afterFirstLayout(mainimg.java:104)
at b4a.example.mainimg.access$000(mainimg.java:17)
at b4a.example.mainimg$WaitForLayout.run(mainimg.java:82)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: java.lang.RuntimeException: Field mainimgclv1 was declared with the wrong type.
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:431)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:454)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
... 18 more
** Activity (mainimg) Resume **

line 64 is the - Activity.LoadLayout("imgsMainLy")
In the big project I use the xui views library as well. Could this be the problem?
And if not what can cause it?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
You are using two different versions of CLV. Maybe one is the old CustomListView and another is the newer xCustomListview

You should use the last one. If you are migrating layouts from the old Project. Make sure to recreate the layout using xCustomListview
 
Upvote 0

yaniv hanya

Active Member
Licensed User
I use the CustomListView from this tutorial
https://www.b4x.com/etp.html?vimeography_gallery=1&vimeography_video=256437236
And the code is the same in both projects.
To simplify the work and not mix with all the parts of the big project, I started a new project on which I built the screens so that it's actually newer than the big one. And when it was ready I just copied all the files to the big project and then it stopped working.
When I copied the files from the big project to a test project it worked again so it probably conflicts with something in the big project and I can't find a what.
i didn't use CustomListView in the big project befor only in this part fo the project.
 
Upvote 0

yaniv hanya

Active Member
Licensed User
The problem is probably from the XUI Views library. (When I added it to the employee project it crashed the same way). I need the XUI Views because I use library controls in other activities in the project.
What can I do to make them work together?
 
Upvote 0

yaniv hanya

Active Member
Licensed User
After a war with this phantom files of the b4a, I finally managed to get it to work with the xCustomListview .
Thank you very much
 
Upvote 0

yaniv hanya

Active Member
Licensed User
First step is to remove the class and add a reference to xCustomListView library.
If this is not understood it means to delete the class code fo the CustomListview file from the project and in the module tab to add the xCustomListview lib. And even after that, it didn't work for me and searched for the file until I deleted from the project directory the b4a.meta file and the objects folder and let the environment re-create them afetr the changes
 
Upvote 0
Top