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:

Informatix

Expert
Licensed User
Longtime User
ID's need to be truly unique in ULV.

It's what I said: an ID is an UNIQUE identifier. So TextID <> ImgID <> ItemID. In some cases, ItemID can be = to ImgID or = to TextID, and I agree that is convenient, but you can never have all three equals. My own practice is to start the ID of text data with "txt" and the ID of images with "img" so there's no confusion between the two types. Then I add the hash value of the path to the resource file and I end with the file name. That gives something like: "img45665454688989logojpg". When the resources come from a database, I simply use the ID of the record, e.g. "txt152". You could do differently.

It doesn't matter if you use only one folder for your cache or many. Since all IDs are supposed to be unique, all resources can be stored in the same folder (their filename is "their_ID.0"). BUT if you use a record ID as in the example above, then there's a chance to have the same ID for records from different tables, so you have to create in this case a subfolder for each ULV using a different set of tables. My own practice is to have the same folder when the ULV share the same data, and separate folders in the other cases.

I will rewrite the documentation for the next version. I will insist on the IDs because my examples are not the best place to explain them.

When (what situation) should I use
1) CloseCache and ReopenDiskCache?
2) StopAsyncLoading?
3) ClearMemoryCache

1) CloseCache: whenever the ULV is no longer used (when you exit the activity for example)
ReopenDiskCache: whenever the cache is closed and you need to reopen it for an already initialized ULV (you may close the cache while in Pause and reopen it when the app resumes)
The cache uses a journal to know the state of writings and the last access to each resource. It uses also buffers for its writings. So to ensure that all writings are flushed to the disk and that the journal is properly closed, it is recommended to call CloseCache when you no longer need the cache.
2) This is automatically called when the app is paused because you cannot load a resource or update an item while in pause. So call this function in the other cases, when you want to cancel the async loadings in progress.
3) This is automatically called by ClearContent to free all resources in the memory cache. Use it if you're short on memory and want to clear the cache.
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Hello, i'm using UltimateListview, but can't remove all item from a view, now i use loop and remove all item using ulv.removeitemat(i).
How remove all item with a single command.
thanks

Raffaele
 

airblaster

Active Member
Licensed User
Longtime User
Hi Informatix,

I kind of curious on what features you have planned for version 4.
So far I'm pretty happy with the current version, only thing I'm missing is support for many loading circles on the list.
And possibly even smoother scrolling with many images on screen.

EDIT:
Regarding loading circles, what I mean is basically support for animated images in the PreLoadCallback.
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
I kind of curious on what features you have planned for version 4.

For now:
- the groups as explained in a previous post;
- the bitmap cache in native memory;
- custom animations when the items are added or deleted;
- docked items.
I will update the documentation and add new examples (including a Pull-to-refresh demo).

support for many loading circles on the list.
What do you mean?

And possibly even smoother scrolling with many images on screen.

When the images are loading with LoadImageAsync, we cannot have something smoother. The time is shared between the thread that loads the picture and the thread that displays the list, and for this reason the smoothness depends strongly on the system and the CPU.
Once the images are loaded, it depends on your code and whether you use cache or not.
 
Last edited:

airblaster

Active Member
Licensed User
Longtime User
Hi Informatix,

thanks for your quick response.
Regarding the loading circles, what I mean is e.g. putting an animated activity indicator to any images that are not yet loaded (quite a few in my app).
As far as I know, this would cause too much load to be realized in the current version.
 

socialnetis

Active Member
Licensed User
Longtime User
Hi Informatrix, I'm very interested in this library. I have a couple of questions before deciding if its what I need.

1) I don't know if you have seen Scringo. Scringo provides a "like button" that can be attached to almost everything (a photo, a video, a comment, etc). To use it, you just need to add it to the activity or a panel, and then run a method called "setLike" (which binds the like button to the content you want). So I would like to have a list of images, and in each element, have this Like button. With CustomListView from Erel, this is very easy to use. But is it going to be possible to use it with ULV? I mean, when an item is recycle, this "setLike" method need to be called.

So, a more generic question would be: is it possible to call any method when recycling elements?

2) I would also like to make a grid-gallery (kind of your customGallery), so basically, in a row there would be more than one imageview. The click events of each imageview will be fired, or the row will eat the click event as an "item" clicked?

3) LoadImageAsync seems to be really useful. But when we use it to display an image from internet, is there a way to acces later to the image downloaded in the device, or the image is "never" downloaded (just goes to a temp folder, and is erased when is not been displayed anymore)?
Also, is there a way to load a smaller imagen than the original size using this method? (something like loadbitmapsample but async)
 

Informatix

Expert
Licensed User
Longtime User
With CustomListView from Erel, this is very easy to use. But is it going to be possible to use it with ULV? I mean, when an item is recycle, this "setLike" method need to be called.

I don't know Scringo and thus I can't answer with certainty, but according to your description, it should work with ULV.

So, a more generic question would be: is it possible to call any method when recycling elements?

What do you mean by "recycling elements"?

2) I would also like to make a grid-gallery (kind of your customGallery), so basically, in a row there would be more than one imageview. The click events of each imageview will be fired, or the row will eat the click event as an "item" clicked?

Both are possible. You can also split your row in cells which have their own click event.

3) LoadImageAsync seems to be really useful. But when we use it to display an image from internet, is there a way to acces later to the image downloaded in the device, or the image is "never" downloaded (just goes to a temp folder, and is erased when is not been displayed anymore)?
Also, is there a way to load a smaller imagen than the original size using this method? (something like loadbitmapsample but async)

LoadImageAsync uses a persistent cache for loaded images. That avoids downloading again the images when you reopen the list.
It is possible to post-process the image before saving it to cache. So you can resize it, crop it, add a border, etc.
 

socialnetis

Active Member
Licensed User
Longtime User
What do you mean by "recycling elements"?
I mean, when recycling a list item. Lets say that at any moment there are only 6 visible items, so I assume there would be around 10 list items in memory (just an assumption, I don't know how you implement it). So lets say I have a listview of 100 items, and I am watching items 3 to 8, so I assume that in ram memory is going to be items from 1 to 10. And when I scroll a little to see items 4 to 9, the item 1 would be recycled to use it as item 11, right? (at least this is the "theory" behind a custom listview).

So, lets say a list item is just an ImageView and a Label, when a list items needs to be recycle, it would change the ImageView.bitmap, and the Label.text.
When this "recycling" occurrs, can I call whatever methods I want? For example, change the Label TextSize, Color, typeface,..?
 

Informatix

Expert
Licensed User
Longtime User
Lets say that at any moment there are only 6 visible items, so I assume there would be around 10 list items in memory (just an assumption, I don't know how you implement it).

6 visible items in the ULV = 6 items in memory.

And when I scroll a little to see items 4 to 9, the item 1 would be recycled to use it as item 11, right? (at least this is the "theory" behind a custom listview).

Ok, we agree about the definition of "recycling", but the CustomListView class does not use that technique. Only the ListView library and the TableView class have such a feature.

When this "recycling" occurrs, can I call whatever methods I want? For example, change the Label TextSize, Color, typeface,..?

Accessing the items directly from anywhere is strongly discouraged in ULV because of the reason you give. The views can be reused by a new visible item, so their reference is not permanent for a given item. But it's not a real problem with ULV because ULV is made entirely to work this way. You have all needed functions to do a very dynamic list, able to change the data and appearance of items in real-time.
 

socialnetis

Active Member
Licensed User
Longtime User
Nice, after seeing the examples and reading the documentation I think this is exactly what I need.
25 euros to your pocket sir.
 

shashkiranr

Active Member
Licensed User
Longtime User
Hi Informatix,

1. In your Chat View example is it possible to change the message bubble shape i mean add our own shape and color.

2. In the expandable List view is it possible to add an animation which shows the opening of the expanded section when the user clicks on an item in the list.

3. In the fast Scroll of the list view (ClsScrollPanelForULV) is there an option to scroll based on the certain variable like scroll according to the alphabetical order or according to date.

Kindly let me know.

Regards,
SK
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
Hi Informatix,

1. In your Chat View example is it possible to change the message bubble shape i mean add our own shape and color.

2. In the expandable List view is it possible to add an animation which shows the opening of the expanded section when the user clicks on an item in the list.

3. In the fast Scroll of the list view (ClsScrollPanelForULV) is there an option to scroll based on the certain variable like scroll according to the alphabetical order or according to date.

Kindly let me know.

Regards,
SK

1) Yes, it is a nine-patch in the drawable folder of the demo resources.
2) It's a bit tricky to do. Maybe the demoAnimatedItems can give you some ideas.
3) I'm not sure to understand what you want to do. Do you mean "jumping from a date to another date" with the fast scroller?
 

shashkiranr

Active Member
Licensed User
Longtime User
Thank you for your reply.

1. That is great :)

2. I checked the demo and yes it opens up a subpanel when an item is clicked. Is there an option for us make animate the opening of the subpanel slowly so that user can see the item expanding.

3. For example in a application which plays songs when you are scrolling the list it shows in Alphabetical order , like songs starting from letter "A" and then "B" and so on. Just wanted to know whether we can get this option while scrolling.
Kindly see the below link it will give you a good idea

http://stackoverflow.com/questions/5122749/create-easy-alphabetical-scrolling-in-listview/5122846

http://twistbyte.com/tutorial/android-listview-with-fast-scroll-and-section-index

Regards,
SK
 

Informatix

Expert
Licensed User
Longtime User
2. I checked the demo and yes it opens up a subpanel when an item is clicked. Is there an option for us make animate the opening of the subpanel slowly so that user can see the item expanding.

No, there's no option. That's why I created this demo.

3. For example in a application which plays songs when you are scrolling the list it shows in Alphabetical order , like songs starting from letter "A" and then "B" and so on. Just wanted to know whether we can get this option while scrolling.
Kindly see the below link it will give you a good idea

Did you look at the DemoDBTableMulti example?
 

shashkiranr

Active Member
Licensed User
Longtime User
Im sorry if i have given you wrong information.

I am working on an app and i urgently need the features ULV can provide. 25 Euro is a big amount for me so before investing needed to clarify my queries so asked a lot of questions.

Regards,
Shashi Kiran
 
Top