Android Question how to get the index from xcustomlistview in b4xswitch?

MbedAndroid

Active Member
Licensed User
Longtime User
with the b4exviews switch i can do this operation:
B4X:
Private value As Object = MenuList.GetValue(MenuList.GetItemFromView(Sender))
i'm using this in a customlistview with multiple switches. To get which switch has been moved in the customlistview i use this code.

But when i switch to b4xswitch the code in customlistview crashes.
There must be a way to figure out which switch has been moved
The switch is dropped on a layout with panel, icon and text. so every line loads this layout. All the switches will have the same name.

Anyone did this before?
crashreport
Error occurred on line: 7033 (Main)
java.lang.ClassCastException: com.xxxxxx.b4xswitch cannot be cast to android.view.View
at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(B4XViewWrapper.java:88)
at anywheresoftware.b4a.objects.B4XViewWrapper.getParent(B4XViewWrapper.java:185)
at b4a.example3.customlistview._getitemfromview(customlistview.java:413)
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:348)
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 anywheresoftware.b4a.BA$2.run(BA.java:387)
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)
 
Last edited:

mangojack

Well-Known Member
Licensed User
Longtime User
Possible solution ...
 
Upvote 0
Top