Android Question [Solved] Dynamic Paging

Discussion in 'Android Questions' started by AHilberink, May 15, 2019.

  1. AHilberink

    AHilberink Active Member Licensed User


    For my project I need Slinding tabs. Every tab is a record from my database. The user can change data on the tab. All tabs are filled with the same panel/layout.

    I have a few questions/difficulties:
    1. What can use best for this: TabStrip or AHViewPager?
    2. I need to save changed data on leaving the tab and reload on every next tab. Can this be done?
    3. Is there a way to reset all objects used at once or do I need to clear them one by one progammaly?

    Thanks in advange for helping me.

    Best regards,
  2. Erel

    Erel Administrator Staff Member Licensed User

    2. You can do it in the PageSelected event.
    3. Panel.RemoveAllViews followed by Panel.LoadLayout.
    AHilberink likes this.
  3. AHilberink

    AHilberink Active Member Licensed User

  4. AHilberink

    AHilberink Active Member Licensed User


    How can I define about 20 tabs? Tabstrip.LoadLayout(..,..) needs a layout to load. Giving them all the same layout: Only the last has the changes made in PageSelected event. Tried it with a Panel on the layout, same result.

    Do I need to make 20 layoutfiles in advange or is there a way to do the changes only on the active page as PageSelected?

    Best regards,
  5. AHilberink

    AHilberink Active Member Licensed User


    I find a solution for this problem with the use of TabStripViewPagerExtendet, with which I can add Panels instead of layouts.

    My source:
    ub Globals
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.

    Private TabStrip1 As TabStrip
    Private CurrentPage As Int
    Private Panel1Dump(100As Panel
    Private Label1 As Label
    Private CheckBox1 As CheckBox
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    For i=0 To 20
    End Sub

    Sub TabStrip1_PageSelected (Position As Int)
    Log($"Current page: ${Position}"$)

    ": "&Position
    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub CheckBox1_CheckedChange(Checked As Boolean)
    If(Checked) Then
    End If
    End Sub
    You can find it the Extended source on:

    Attached you wil find my complete test project.

    May be usefull for someone.

    Best regards,

    Attached Files:

    José J. Aguilar likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice