B4i Library [class] CustomListView

jahswant

Well-Known Member
Licensed User
Longtime User
Declare all CustomListViews as process global variables and they will work properly.
I think i don't understand this very well.

I need to make something like this.

B4X:
Sub ListViewCats_ItemClick (Index As Int, Value As Object)
    Reader.Concerned = PG.Title
    Reader.Subcat = Value
    Reader.Show
End Sub

This is my show code in reader

B4X:
Public Sub Show
    Main.NavControl.ToolBarVisible = False
    btnBack.InitializeText("Previous","Previous")
    If PG.IsInitialized = False Then
        PG.Initialize("PG")
        PG.RootPanel.LoadLayout("mainreader")
        PG.RootPanel.Color = Colors.White
        pnlContent.LoadLayout("readerlayout")
        PG.HideBackButton = True
    End If
  
    Main.NavControl.ShowPage(PG)
   
     ListViewCats.Clear

    PG.Title = "Learn Arabic" & " V " & Utils.GetVersion
  
    lblMenu.Text = Concerned
  
    lblSousMenu.Text = Subcat
  
    Timer1.Initialize("Timer1",1)
      
    ImageView1.Bitmap = Utils.ResizeImage (LoadBitmap(File.DirAssets,"play.png"),ImageView1.Width,ImageView1.Height)
  
    FillListView(Concerned,Subcat)
End Sub

First time it displays correctly but when i come for the second time.Items are not displayed correctly and the third time items are not visible at all.What are the best practices when you have to do such actions ?
 
Last edited:

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Do you have some sample to create programmatically?

I´ve tried this but not work!

B4X:
Dim clvComment As CustomListView
clvComment.Initialize(Me,"clvComment")
pnlLine.AddView(clvComment.GetBase,5dip,5dip,100%x,50dip)
clvComment.Clear

or how to get this view from layout?? Like this?

Dim clvComment As CustomListView = p.GetView(0)
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…