Hi there...
I am loading the same layout with with different values to the customlistview and or scrollview. For example, for each "map" data record I have, I load the layout to a panel then I am tagging the views like this for every item I am adding. There are multiple data records between 1-10. Everything seems to work well.
The example image of my view is attached herein.
I have seen in some examples that one can follow the GetView approach like this..
using the index of the view to tag it etc. The thing is with layouts with multiple views like mine, how does one know which view has which index then to pass that to GetView?
The reason I'm asking, for some reason, which the approach I have used, the tag values are lost and I'm trying to find the cause. I will test with moving my variable declarations to Process_Globals for now.
My questions are:
I am loading the same layout with with different values to the customlistview and or scrollview. For example, for each "map" data record I have, I load the layout to a panel then I am tagging the views like this for every item I am adding. There are multiple data records between 1-10. Everything seems to work well.
B4X:
' set the view tags
Dim pan As Panel
pan.Initialize("")
Activity.AddView(pan,0dip,0dip,100%x,100%y)
pan.LoadLayout("followingeach")
pan.Tag = jMap
user_to = jMap.Get("id")
user_to_name = jMap.Get("username")
jMap.Put("user_to", user_to)
jMap.Put("user_to_name", user_to_name)
jMap.Put("user_from", auser_id)
jMap.Put("user_from_name", auser_name)
lblType.Text = "Search..."
imgUserLogo.Tag = "user" & user_to
lblUserName.Tag = "lblUserName_" & user_to
lblUserName.Text = user_to_name
btnToday.Tag = "btnToday_" & user_to
btnFollowUser.Tag = "follow_" & user_to
btnTrayUser.Tag = "tray_" & user_to
btnNewsFeeds.Tag = "newsfeeds"
btnDay.Tag = "day"
btnProfile.Tag = "profile"
btnTray.Tag = "tray"
btnTrayO.Tag = "trayo"
imgLoad.Tag = "load_" & user_to
imgLoad.Visible = True
The example image of my view is attached herein.
I have seen in some examples that one can follow the GetView approach like this..
B4X:
dim lbl as label = pan.GetView(0)
lbl.tag = "xxx"
using the index of the view to tag it etc. The thing is with layouts with multiple views like mine, how does one know which view has which index then to pass that to GetView?
The reason I'm asking, for some reason, which the approach I have used, the tag values are lost and I'm trying to find the cause. I will test with moving my variable declarations to Process_Globals for now.
My questions are:
- With GetView, how does one determine the index of each view added to the layout?
- Is tagging by view name e.g. btnTrayUser.Tag = "tray_" & user_to, for such cases where the same layout is loaded with different values a better approach than GetView?