Android Question CustomListView update items in inserted panel

ronovar

Active Member
Licensed User
Longtime User
How can i update items in panel?

For example: i have 300 items in clvMaster list and when apk start it fills 300 items in clvMaster using:

B4X:
clvMaster.InsertAt(ScrolledChannel, CreateChannelListMaster(ScrolledChannel, clvMasterCh.AsView.Width, 167dip, Channels(ScrolledChannel,3), Channels(ScrolledChannel,2), EPGs(ScrolledChannel,0), EPGs(ScrolledChannel,1), EPGs(ScrolledChannel,2), EPGs(ScrolledChannel,3)), 167dip, ScrolledChannel)
That works great...i have the following labels in each panel:

B4X:
'UPDATE - EPGlblEPGName.Text = EPGs(ScrolledChannel,0)
lblEPGStart.Text = EPGs(ScrolledChannel,1).SubString2(11, 16)
lblEPGStop.Text = EPGs(ScrolledChannel,2).SubString2(11, 16)
lblEPGDesc.Text = EPGs(ScrolledChannel,3)
I have tried using removeitemat and insertitem at but i have duplicate panels, and would like to avoid this...can be added in this excellent class function:

B4X:
Sub UpdateItemsAtPanel(Index As Int, Pnl AsPanel, ItemHeight As Int, Value As Object, lblEPGName, lblEPGStart, lblEPGStop, lblEPGDesc AsString)'UPDATE - EPGpanel(index).lblEPGName.Text = lblEPGNamepanel(index).lblEPGStart.Text = lblEPGStartpanel(index).lblEPGStop.Text = lblEPGStartpanel(index).lblEPGDesc.Text = lblEPGDescEnd Sub
So the idea is to not remove existing panels in list witch is generated at apk start, only to update labels in existing panels at index....can erel or someone posto here code how to do that with this excellent class?
 

mangojack

Expert
Licensed User
Longtime User
B4X:
Dim pnl As Panel
pnl = clv1.GetPanel(rowIndex)
   
Dim lbl As Label   
lbl = pnl.GetView(viewIndex)
lbl.Text = "NewText"
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
The above code works excellent...i have need to add one more panel inside clv1 master panel...inside that panel is label that holds text...how can i access this label? For example...i need to get somthing like this:



So idea is how to get Panel2 in customlistview so that i can update Label1.text?

Thanks.
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Knowing the order and types of views added to the panels ...
B4X:
Dim p1 As Panel = clvMaster.GetPanel (Index)
Dim p2 As Panel = p1.GetView(0)    '1st view added to master panel - Index 0
Dim l As Label = p2.GetView(0)     '1st view added to child panel - Index 0
l.Text = "abc"
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…