B4A Library [Lib] UltimateListView

I've been working on this project for a long time and I'm very proud to release the version 4 today.

The UltimateListView is, as its pompous name says, THE ListView.

  • It can handle very long lists. This is a screenshot of a list with 245813 items, all different:

    verylonglist.jpg


  • It can mix different layouts (and they can be changed dynamically). You can use it as an expandable ListView:

    layouts.jpg


  • It has a low memory footprint and is very fast (this report comes from the Performance demo where the list has to display 128901 distinct words read from a database and the used device is a Huawei Honor single core 1.4 Ghz):

    performance.png


  • It can scroll in both directions thanks to its swipe detector:

    tables.jpg


  • The swipe detector can also be used to implement a swipe-to-dismiss or a swipe-to-reveal:

    swipedetector.png
  • You can easily add editors to your table to change its content:

    celledit.jpg


  • You can animate the items when they are added, removed, replaced or when the list is scrolled (with your own custom animation):

    animationclap.png


  • It can stack items from the bottom:

    stackfrombottom.png


  • It supports drag & drop operations (internal & external):

    dragndrop.png


  • You can synchronize lists with different item heights:

    grid.jpg
The examples will show you how to implement a Pull-to-Refresh, create sticky headers or combine several lists to make a wheel. One of the examples is an improved version of my File Explorer class.

All texts and images can be loaded asynchronously (from Internet, from a database or from a local folder), so you can scroll even if the data are not fully loaded.

The list has its own state manager.

Since September 2018, ULV is available for free. You can still donate for it if you wish.
To send the money, just click on the Donate button below (the amount to enter is in euros):


Note that UltimateListView is not a wrapper around the work of someone else. It is 100% my own code and it is based upon the standard Java ListView of Android.

The UltimateListView does not work with Android versions < 2. It cannot work with B4J or B4i.

Current version: 4.50

DOWNLOAD HERE:
 
Last edited:

shashkiranr

Active Member
Licensed User
Longtime User
There's a new version available. It requires B4A v5.80.

Changelog:
- UltimateListView can be added as a custom view in the designer;
- I fixed a minor bug in ClsExplorerForULV.bas;
- I added a "assets:" tag to LoadImageAsync to load images from the assets;
- I added the DeleteAllStateFiles function;
- I added the Parent property;
- I added the SynchronizePositionWith function and a demo that shows its usefulness;
- I added 12 new styles for SetStyle (still using system drawables);
- I udpated the manifest of examples and fixed a few style issues.

Hi Fred,

I did not receive the link for the new version. I just sent you an email too.

Best,
SK
 

luke2012

Well-Known Member
Licensed User
Longtime User
Hi @Informatix,
First of all, this post is NOT a support request, this is a my consideration as licensed ULV user.

I have to use the ULV within my new project based on @Erel CloudKVS solution as data repository.

The point is that I must use a UUID as items ID but ULV DON'T allow to set UUID as item ID (only int IDs).
Absurdly your (FREE) CheckList Class (https://www.b4x.com/android/forum/threads/class-checklist.18853/) support also UUID (string) item IDs (I successfully implemented a clsCheckList object that use UUID as item ID).

I think that it's UNREASONABLE because I paid a license to use ULV (CheckList is free) and to obtain the advance of the new ULV and I cannot use it within my important (current) project as UI.

THE POINT IS:
I have to abandon the ULV (as licensed user) in my new projects losing all the (paid) advantages and prefer the (FREE) CheckList Class that allow to load UUID as item ID (or others UIs) ?
In this case I have to migrate all my ULV implementations to CheckList Class with all the DISAVANTAGES like more implementation time & effort (a step back).

I entrust in your good sense for a concrete reply (action) about this.

Thanks in advance.
 

fredo

Well-Known Member
Licensed User
Longtime User
Hi @luke2012,
even though you adressed your post to Informatix I don't like the tone and I feel obligated to reply for some reasons.
I use the ULV in all of my projects since the first version came out and had never the necessity to use another listview.

I often had databases with natural keys (or even UUID) and a vast amount of recordsets to display.
In your special case it would be an option to work with a global list to hold the UUIDs and iterate through the list to perform the ulv.additem().
Then in the ContentFiller you use the ItemId to pick the UUID from the global list to get to the CloudKvs-value.

Away from that, Informatix was always very helpful even with my most annyoing questions. He answers via email from Monday to Friday.

Best regards,
fredo
 

Informatix

Expert
Licensed User
Longtime User
Hi @Informatix,
First of all, this post is NOT a support request, this is a my consideration as licensed ULV user.

I have to use the ULV within my new project based on @Erel CloudKVS solution as data repository.

The point is that I must use a UUID as items ID but ULV DON'T allow to set UUID as item ID (only int IDs).
Absurdly your (FREE) CheckList Class (https://www.b4x.com/android/forum/threads/class-checklist.18853/) support also UUID (string) item IDs (I successfully implemented a clsCheckList object that use UUID as item ID).

I think that it's UNREASONABLE because I paid a license to use ULV (CheckList is free) and to obtain the advance of the new ULV and I cannot use it within my important (current) project as UI.

THE POINT IS:
I have to abandon the ULV (as licensed user) in my new projects losing all the (paid) advantages and prefer the (FREE) CheckList Class that allow to load UUID as item ID (or others UIs) ?
In this case I have to migrate all my ULV implementations to CheckList Class with all the DISAVANTAGES like more implementation time & effort (a step back).

I entrust in your good sense for a concrete reply (action) about this.

Thanks in advance.
1) ULV and CheckList do not share the same philosophy and thus have different features. CheckList is, like ListView, able to store data in its views, while ULV cannot. ULV is built on a different basis, with a different approach, because of the big memory use and the bad performance of CheckList. That implies different drawbacks in the end.
2) If I had just to change long to string in my code, I would do it right now but it's a bit more complicated. Mostly because I use a data structure to store my items that is far more performant when based on longs than on strings, and because strings are a huge waste of memory while memory is scarce on Android devices (less true nowadays but very important when I initially created ULV).
3) You're not the first person to use UUIDs or, more globally, strings as unique identifiers. There exist solutions for that and I know a lot of happy users of ULV who implemented them. For example, hashing the string or managing a simple list to make the correspondance between the UUID and the item ID (it's what I would have to do in the ULV code anyway if I wanted to support strings).
4) You will note that the cache ID are strings in ULV. So you can see that I have nothing against strings and use them whenever it's possible and affordable (in the cache, string is the natural type because filenames are strings).
5) I never hid the fact that the ItemID is a long value and not a string. Anyone can read the type in the document available in post #1.
 
Last edited:

fredo

Well-Known Member
Licensed User
Longtime User
... or managing a simple list to make the correspondance between the UUID and the item ID ...

@luke2012 Maybe this "quick and dirty" approach gives you a starter...

B4X:
Sub Globals
    Dim ULV As UltimateListView
    Dim lstUUIDs As List
End Sub
B4X:
    ' --- --- --- --- --- --- --- ---
    ' Put UUIDs in a global List
    ' This is a necessary step to
    ' keep the ItemId and UUId in synch
    ' --- --- --- --- --- --- --- ---
    Dim lstUUIDs As List
    lstUUIDs.Initialize
    For i=0 To kvs.ListKeys.Size -1
        lstUUIDs.Add(kvs.ListKeys.Get(i)) ' This ensures that the index of the lstUUIDs is the same as the index of kvs.ListKeys
    Next  

    ' --- --- --- --- --- --- --- ---
    ' Fill the ULV
    ' --- --- --- --- --- --- --- ---
    For i=0 To lstUUIDs.Size -1
        ULV.AddItem("MEAL", i) ' "i" is the common reference for kvs and the global list
    Next
B4X:
Sub ulvMeal_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
    Dim lblTextA As Label = LayoutPanel.GetView(0)
    Dim lblTextB As Label = LayoutPanel.GetView(1)
    Dim lblTextC As Label = LayoutPanel.GetView(2)

    Dim mapY As Map = kvs.Get( lstUUIDs.Get(ItemID) ) ' <-- here it happens. The ItemId is "translated" to the UUID. Now you can get the kvs-data for this key
  
    lblTextA.Text = $"ItemID=${ItemID}, UUID=${lstUUIDs.Get(ItemID)}"$
...
 

Attachments

  • ULV_UUID_approach.zip
    15.2 KB · Views: 135

luke2012

Well-Known Member
Licensed User
Longtime User
Hi @luke2012,
even though you adressed your post to Informatix I don't like the tone and I feel obligated to reply for some reasons.
I use the ULV in all of my projects since the first version came out and had never the necessity to use another listview.

I often had databases with natural keys (or even UUID) and a vast amount of recordsets to display.
In your special case it would be an option to work with a global list to hold the UUIDs and iterate through the list to perform the ulv.additem().
Then in the ContentFiller you use the ItemId to pick the UUID from the global list to get to the CloudKvs-value.

Away from that, Informatix was always very helpful even with my most annyoing questions. He answers via email from Monday to Friday.

Best regards,
fredo

Sorry for my direct tone (generally I'm not so direct in my post / conversations) but in this case I have to take a quick decision to continue to use ULV (considering that I like it) or to choose another option.

Finally I agree with you that @Informatix is very helpful :)
 

Informatix

Expert
Licensed User
Longtime User
Sorry for my direct tone (generally I'm not so direct in my post / conversations) but in this case I have to take a quick decision to continue to use ULV (considering that I like it) or to choose another option.

Finally I agree with you that @Informatix is very helpful :)
In my opinion, there's no reason to use ClsCheckList any more.
The most obvious and easy solution to support strings as ID is to add a field in your DB to store the numerical ID that can be computed with a simple hash function. In case you prefer to use a list, you can use the solution given by Fredo above. I would change the data type to SparseArray (from the DataCollection lib) as it allows gaps in the sequence (so you can remove items without issue), is similar to a map and is as fast as a list.
 

luke2012

Well-Known Member
Licensed User
Longtime User
1) ULV and CheckList do not share the same philosophy and thus have different features. CheckList is, like ListView, able to store data in its views, while ULV cannot. ULV is built on a different basis, with a different approach, because of the big memory use and the bad performance of CheckList. That implies different drawbacks in the end.
2) If I had just to change long to string in my code, I would do it right now but it's a bit more complicated. Mostly because I use a data structure to store my items that is far more performant when based on longs than on strings, and because strings are a huge waste of memory while memory is scarce on Android devices (less true nowadays but very important when I initially created ULV).
3) You're not the first person to use UUIDs or, more globally, strings as unique identifiers. There exist solutions for that and I have a lot of happy users of ULV that implemented them. For example, hashing the string or managing a simple list to make the correspondance between the UUID and the item ID (it's what I would have to do in the ULV code anyway if I wanted to support strings).
4) You will note that the cache ID are strings in ULV. So you can see that I have nothing against strings and use them whenever it's possible and affordable (in the cache, string is the natural type because filenames are strings).
5) I never hid the fact that the ItemID is a long value and not a string. Anyone can read the type in the document available in post #1.

First of all thanks for your quick and professional reply.

1) "CheckList is, like ListView, able to store data in its views, while ULV cannot" : but ULV doesn't mean Ultimate "ListView" ? :)

3) Yes, I known that there are workarounds like hashing and mapping between ULV IDs and CloudKVS IDs but it's a pity to implement workarounds to handle Items IDs within the ULV because the ULV handle Item IDs very well in a "native mode".
You Says: "it's what I would have to do in the ULV code anyway if I wanted to support strings".
It's in the next days plan or in a future plan? Sorry I ask you directly because I have to known if in the next few days I have to implement a custom workaround within my code or not.

P.S.
Away from that I'm a happy "Ultimate List View" user until now.
 

luke2012

Well-Known Member
Licensed User
Longtime User
@luke2012 Maybe this "quick and dirty" approach gives you a starter...

B4X:
Sub Globals
    Dim ULV As UltimateListView
    Dim lstUUIDs As List
End Sub
B4X:
    ' --- --- --- --- --- --- --- ---
    ' Put UUIDs in a global List
    ' This is a necessary step to
    ' keep the ItemId and UUId in synch
    ' --- --- --- --- --- --- --- ---
    Dim lstUUIDs As List
    lstUUIDs.Initialize
    For i=0 To kvs.ListKeys.Size -1
        lstUUIDs.Add(kvs.ListKeys.Get(i)) ' This ensures that the index of the lstUUIDs is the same as the index of kvs.ListKeys
    Next 

    ' --- --- --- --- --- --- --- ---
    ' Fill the ULV
    ' --- --- --- --- --- --- --- ---
    For i=0 To lstUUIDs.Size -1
        ULV.AddItem("MEAL", i) ' "i" is the common reference for kvs and the global list
    Next
B4X:
Sub ulvMeal_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
    Dim lblTextA As Label = LayoutPanel.GetView(0)
    Dim lblTextB As Label = LayoutPanel.GetView(1)
    Dim lblTextC As Label = LayoutPanel.GetView(2)

    Dim mapY As Map = kvs.Get( lstUUIDs.Get(ItemID) ) ' <-- here it happens. The ItemId is "translated" to the UUID. Now you can get the kvs-data for this key
 
    lblTextA.Text = $"ItemID=${ItemID}, UUID=${lstUUIDs.Get(ItemID)}"$
...

Not only @Informatix is very helpful :)
Thanks I'll try your code.
 

Informatix

Expert
Licensed User
Longtime User
First of all thanks for your quick and professional reply.

1) "CheckList is, like ListView, able to store data in its views, while ULV cannot" : but ULV doesn't mean Ultimate "ListView" ? :)

3) Yes, I known that there are workarounds like hashing and mapping between ULV IDs and CloudKVS IDs but it's a pity to implement workarounds to handle Items IDs within the ULV because the ULV handle Item IDs very well in a "native mode".
You Says: "it's what I would have to do in the ULV code anyway if I wanted to support strings".
It's in the next days plan or in a future plan? Sorry I ask you directly because I have to known if in the next few days I have to implement a custom workaround within my code or not.

P.S.
Away from that I'm a happy "Ultimate List View" user until now.
1) ULV is a component to view a list, and that's what a ListView is supposed to be. Note that ULV is based upon a standard Android ListView, as the B4A ListView. They share the same parent.
2) No nothing is planned. As I explained, adding the support for strings would reduce the performance and increase the memory consumption for everyone although there's only a fraction of users who needs this feature.
If I had to move from long to something else, "something else" would be a generic object, not a string.
 

jazzzzzzz

Active Member
Licensed User
Longtime User
Hi, I haven't bought Ultimatelistview, but am willing to buy if its works good for my scenario.

I have uploaded a screenshot of one of my page,here i have a large list of photos which i have to download from internet.(I use image downloader by Erel) .

Am currently using a scroll view to display this. Can i use ultimate list view other than using scrollview to create the same page and achieve good optimization?

I have to click on each of the image to make a preview in other activity
 

Attachments

  • Screenshot_20160707-194042.gif
    Screenshot_20160707-194042.gif
    190.4 KB · Views: 155

Informatix

Expert
Licensed User
Longtime User
Hi, I haven't bought Ultimatelistview, but am willing to buy if its works good for my scenario.

I have uploaded a screenshot of one of my page,here i have a large list of photos which i have to download from internet.(I use image downloader by Erel) .

Am currently using a scroll view to display this. Can i use ultimate list view other than using scrollview to create the same page and achieve good optimization?

I have to click on each of the image to make a preview in other activity
Yes, you can do that with ULV without any problem, and you will benefit from a huge reduction of the memory consumption.
 

Mashiane

Expert
Licensed User
Longtime User
Hi

Can one be able to have one or similar layouts per item? For example I have 5 layouts that could appear with images and labels and some with buttons. Thus item 10 can have the same image on the left as item 2 on the list with a different image on the right. The images will be read from a web server. How can I achieve that, can you please advise?

I have attached a sketch of what I want to do here.
 

Attachments

  • question1.png
    question1.png
    50.3 KB · Views: 153
Last edited:

Informatix

Expert
Licensed User
Longtime User
Hi

Can one be able to have one or similar layouts per item? For example I have 5 layouts that could appear with images and labels and some with buttons. Thus item 10 can have the same image on the left as item 2 on the list with a different image on the right. The images will be read from a web server. How can I achieve that, can you please advise?

I have attached a sketch of what I want to do here.
Support is only provided by EMAIL.
 

luke2012

Well-Known Member
Licensed User
Longtime User
1) ULV is a component to view a list, and that's what a ListView is supposed to be. Note that ULV is based upon a standard Android ListView, as the B4A ListView. They share the same parent.
2) No nothing is planned. As I explained, adding the support for strings would reduce the performance and increase the memory consumption for everyone although there's only a fraction of users who needs this feature.
If I had to move from long to something else, "something else" would be a generic object, not a string.

A generic object could be a good solution.
 

asales

Expert
Licensed User
Longtime User
Hi, I haven't bought Ultimatelistview, but am willing to buy if its works good for my scenario.

I have uploaded a screenshot of one of my page,here i have a large list of photos which i have to download from internet.(I use image downloader by Erel) .

Am currently using a scroll view to display this. Can i use ultimate list view other than using scrollview to create the same page and achieve good optimization?

I have to click on each of the image to make a preview in other activity

See this example of image grid with ULV:
https://www.b4x.com/android/forum/threads/ultimatelistview-image-grid-example.63857/
ulv_grid1.jpg
 
Top