Hi all,
I have 2 CustomListViews with panels which are almost duplicates in the fact that they use the same controls and labels. Everything seems to be working ok except that i am having problems identifying from which panel a button is being pressed.
The code for the button press is simple
Dim button As B4XView = Sender
Try
Dim index As Int = clv1.GetItemFromView(Sender)
Dim Pnl As B4XView = clv1.GetPanel(index)
Catch
Log(LastException)
Dim index As Int = clv2.GetItemFromView(Sender)
Dim Pnl As B4XView = clv2.GetPanel(index)
End Try
Dim lbl As B4XView = dd.GetViewByName(Pnl, "Total")
I can press either panel's button multiple times with no problem, then go to the next panel and press that but and all ok but if I then go to the first panel again I get a crash
1st line of error is this ' java.lang.ClassCastException: android.view.ViewRootImpl cannot be cast to android.view.View
After searching the forum I have come to the conclusion that it's because of multiple error catching at the catch try block, however I am unsure as to how I can identify the correct customListView (clv1 or clv2)
Other relevant code is as follows
Private clv1 As CustomListView
Private clv2 As CustomListView
...
clv1.AsView.Tag = clv1
clv2.AsView.Tag = clv2
Does anyone have any idea how I might be able to identify from which panel the button is pressed so that I can access the correct customlistview
Many Thanks