Android Question Return StdViewPager ?

Mashiane

Expert
Licensed User
Longtime User
Hi there

I have a StdViewPager inside each customlistview item. I want to scroll to a particular page of the pager within some customlistview item.

1. I am able to scroll to each item after finding the value of the item with.

B4X:
Sub ListViewScrollToValue(lstView As CustomListView, Value As String) As Int
    Dim lstTot As Int
    Dim lstCnt As Int
    Dim lstStr As String
    lstTot = lstView.GetSize - 1
    For lstCnt = lstTot To 0 Step -1
        lstStr = lstView.GetValue(lstCnt)
        Select Case lstStr
        Case Value
            lstView.JumpToItem(lstCnt)
            Return lstCnt
        End Select
    Next
End Sub

and this works perfectly.

2. Now I try to get the StdViewPager within the panel and have problems

B4X:
user_to = m.Get("user_to")
    ' get the panel at the position returned with ListViewScrollToValue
    pnl = lstFriends.GetPanel(pos)
    ' loop through each view in the panel
    For Each v As View In pnl.GetAllViewsRecursive
        vTag = v.tag
        ' if its a pager it will have a tag property of 'pager1...n'
        If vTag = "pager" & user_to Then
            ' return this pager and scroll to a certain page
            'v.ScrollTo(pv,False)
        End If
    Next

How do I return the pager to a global variable and scroll to a particular page (bold), log(v) does provide a map of the control however I cant access this?

Any advice anyone?
 
Top