Android Question Adding items to list view

Nitin Joshi

Active Member
Licensed User
Longtime User
I am using list view in B4A. There are two pages B4XMainPage and B4XPageA
I have added items in list view while B4XPageA is created (i use B4XPages.AddPageAndCreate). B4XPageA appears from B4XMainPage when button is clicked. It seems that list will be empty when B4XPageA appears.
Do i need to add items in list view when B4XPageA is appeared instead of B4XPageA is created?
 
I hope that you are using CustomListView
I am using List view as i just need to keep simple data to set time, using ListView object and sample code...

Code: Copy
Dim lst as ListView
lst.initialize("Lst")
lst.AddSingleLine("AM")
lst.AddSingleLine("PM")
 
Upvote 0
Upload a small project showing the problem, it will be easier to help you
 
Upvote 0
i want to use cross platform control
If you want your project to be cross platform, then use xCustomListView (cross-platform). Listview is B4A specific
 
Upvote 0
customelistview?
The xCustomListView is cross-platform. Everything that has a [B4X] in the title is cross-platform, but sometimes it can be that [B4X] is in the title and a platform is not supported, but this is usually stated in the thread.
 
Upvote 0
Out of curiosity: if the ListView (or, better, CLV) is just for those two values (AM/PM) why not use a B4xSwitch, a radio button group ora any similar view?
Same for hours/minutes. There are quite a few "specialized" views available in the Forum.

I understand that a quick and dirty solution looks appealing at first, but in the long run (i.e. well before your project is over) you may regret that choice.

For portabiliy among platforms: use B4XPages, use anchors in Design, prefer B4X views.
 
Upvote 0
@udg Thanks for your suggestion. I will think over it. Meanwhile, as Erel suggested, I will use xCustomListView instead of List View.
 
  • Like
Reactions: udg
Upvote 0
Back
Top