Greetings,
I'm trying to extract the value from a label that's in the custom list view item that the user clicks.
Based on this thread and coding example, I set up this Type structure to get values from my custom list view when an item is clicked. Later I will be adding more items into the Type structure.
In the custom list view item click is this code:
When I click on one of the custom list view items, I get a cast error in the Logs:
Looks like I missed something in the tutorial or the thread I got this information from but I'm not sure what I'm missing.
Thanks.
I'm trying to extract the value from a label that's in the custom list view item that the user clicks.
Based on this thread and coding example, I set up this Type structure to get values from my custom list view when an item is clicked. Later I will be adding more items into the Type structure.
B4X:
Type typListItemValues (LabelSongTitle As Label)
In the custom list view item click is this code:
B4X:
Sub clvSongList_ItemClick (Index As Int, Value As Object)
Dim iv As typListItemValues = Value
Log("You clicked song title: " & iv.LabelSongTitle.Text)
End Sub
When I click on one of the custom list view items, I get a cast error in the Logs:
B4X:
** Activity (main) Resume **
*** Service (servicemodule) Create ***
** Service (servicemodule) Start **
main_clvsonglist_itemclick (java line: 427)
java.lang.ClassCastException: java.lang.Integer cannot be cast to b4a.natures.song.main$_typlistitemvalues
at b4a.natures.song.main._clvsonglist_itemclick(main.java:427)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1082)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:1045)
at b4a.example3.customlistview$ResumableSub_PanelClickHandler.resume(customlistview.java:805)
at b4a.example3.customlistview._panelclickhandler(customlistview.java:748)
at b4a.example3.customlistview._panel_click(customlistview.java:735)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:7869)
at android.view.View.performClickInternal(View.java:7838)
at android.view.View.access$3600(View.java:886)
at android.view.View$PerformClick.run(View.java:29362)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8125)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Looks like I missed something in the tutorial or the thread I got this information from but I'm not sure what I'm missing.
Thanks.