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
I am so sorry. My mistake. I had tried the ItemTouch not the Touch event.

The Touch event works fine but it does not do what I wanted it to do. It does not provide a means to determine the ID or Position of the Item.
Originally, I was trying to get the ID or Position from the ItemTouch event, which does not fire, for some reason.

So now I get the label contained in the layout and in the label_click event I read the Sender and get its tag property added in the ContentFiller sub.
It works.

Thanks for you help
You certainly not tried with an unmodified copy of the tutorial project. ItemTouch works fine on all devices, with all versions. Either you tried with a project containing a Touch event for the label, or a project containing items divided into cells (in this case, the event is CellTouch).
 

jimmyF

Active Member
Licensed User
The first project of the tutorial works fine.
But the tutorial project does NOT use the more complex features that I am using which are Animation, Animation Plus, Swipe, and Scroll which all work very well.
The ItemClick, ItemLongClick, and ItemTouch do not work in my project.

Here is my ULV setup code:
B4X:
ULV.Initialize(0, 0, "", "ULV")
    ULV.ClearContent
    ULV.SetPadding(5dip, 5dip, 5dip, 5dip)
    ULV.AddLayout("Item", "Item_LayoutCreator", "Item_ContentFiller", 75dip, True)
    ULV.PressedDrawable = Null
    ULV.SelectionMode = ULV.SELECTION_SINGLE
    ULV.SelectWithClick = True
    ULV.AtLeastOneSelection=False
    Dim cd As ColorDrawable
    cd.Initialize(Colors.Green, 0)
    ULV.PressedDrawable = cd
    ULV.FadingEdges(True)
    ULV.Background = cd
    ULV.Color = Colors.Black

    ULV.DividerHeight = 7dip
    ULV.FastScroller(True)
        
    mapItems.Initialize
    
    Dim idx As Long
    ULV.AnimationCleaner = True
    Activity.AddView(ULV, 0, TBarHeight + edtSeek.Height + HeaderHeight + 5dip, 100%x , 100%y-(TBarHeight + edtSeek.Height + HeaderHeight))
            
    For i = 0 To dbCursor.RowCount - 1   
        
        dbCursor.Position = i
        
        Dim NewItem As typItemData
        NewItem.Initialize       
        NewItem.Anim.Initialize(Me, "Anim_AnimationEnd")       
        NewItem.Text = dbCursor.GetString("Note")

        idx = dbCursor.GetInt("DataID")
        
        mapItems.Put(idx, NewItem)
        
        ULV.AddItem("Item", idx)               
        ULV.MinimumDistanceForSwipe = 60dip
        ULV.SetSwipeDirection(i, ULV.SWIPE_DIRECTION_BOTH)
    Next
    
    ULV.AnimationCleaner = True
 

Informatix

Expert
Licensed User
The first project of the tutorial works fine.
But the tutorial project does NOT use the more complex features that I am using which are Animation, Animation Plus, Swipe, and Scroll which all work very well.
The ItemClick, ItemLongClick, and ItemTouch do not work in my project.

Here is my ULV setup code:
B4X:
ULV.Initialize(0, 0, "", "ULV")
    ULV.ClearContent
    ULV.SetPadding(5dip, 5dip, 5dip, 5dip)
    ULV.AddLayout("Item", "Item_LayoutCreator", "Item_ContentFiller", 75dip, True)
    ULV.PressedDrawable = Null
    ULV.SelectionMode = ULV.SELECTION_SINGLE
    ULV.SelectWithClick = True
    ULV.AtLeastOneSelection=False
    Dim cd As ColorDrawable
    cd.Initialize(Colors.Green, 0)
    ULV.PressedDrawable = cd
    ULV.FadingEdges(True)
    ULV.Background = cd
    ULV.Color = Colors.Black

    ULV.DividerHeight = 7dip
    ULV.FastScroller(True)
       
    mapItems.Initialize
   
    Dim idx As Long
    ULV.AnimationCleaner = True
    Activity.AddView(ULV, 0, TBarHeight + edtSeek.Height + HeaderHeight + 5dip, 100%x , 100%y-(TBarHeight + edtSeek.Height + HeaderHeight))
           
    For i = 0 To dbCursor.RowCount - 1  
       
        dbCursor.Position = i
       
        Dim NewItem As typItemData
        NewItem.Initialize      
        NewItem.Anim.Initialize(Me, "Anim_AnimationEnd")      
        NewItem.Text = dbCursor.GetString("Note")

        idx = dbCursor.GetInt("DataID")
       
        mapItems.Put(idx, NewItem)
       
        ULV.AddItem("Item", idx)              
        ULV.MinimumDistanceForSwipe = 60dip
        ULV.SetSwipeDirection(i, ULV.SWIPE_DIRECTION_BOTH)
    Next
   
    ULV.AnimationCleaner = True
If you add the following code to the Bookmark example in the Swipe demo, you will see that all item events are working:
B4X:
Sub ULV_ItemTouch(Position As Int, Action As Int, X As Int, Y As Int, TouchedPanel As Panel)
   Log("TOUCH")
End Sub

Sub ULV_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
   Log("CLICK")
End Sub

Sub ULV_ItemLongClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
   Log("LONG CLICK")
End Sub
So the problem is in your code. You block the events in some way or you did not declare them as they should be.
 

jimmyF

Active Member
Licensed User
So the problem is in your code. You block the events in some way or you did not declare them as they should be.

Absolutely correct! I blocked them.

I had an additional panel somehow hidden in the layout (copied and pasted from a sample :D)

So...after pretty much dismantling all my code, libraries, manifest, everything, I checked my Item_LayoutCreator and discovered I was loading another panel with two unused buttons.

Oh boy!

Sorry to waste your time Fred.

This is such a good product. I am using it in a couple of corporate projects.
 

Beja

Expert
Licensed User
Hi Frederic,
A long time ago I (believe) I donated and received the library and examples, but to be honest I can't say for sure since I didn't
back up all files from my old computer.. but your libraries deserve many times donations.
 

Informatix

Expert
Licensed User
Thanks Fred,
Would you please WhatsApp me.. My WahtsApp is the same as my mobile phone number.
I don't have Whatsapp, and the only way to contact me is by email or this forum. I'm not on any social network. I don't even have a Facebook account.
 

Informatix

Expert
Licensed User
It has been reported to me that ULV causes crashes on some devices running Android 9. After analyzing the logs, the problem ("null pointer dereference") comes from a C library, libhwui.so, which is part of the system, so I don't see what I can do about ULV. Note that by searching on the internet you can find similar cases affecting other products.
 

SayCheese

Member
Licensed User
Just scratching the surface of B4A I started exploring ULV. The overall performance and flexibility of ULV is really awesome.
However, when I wanted to use the ULV_ItemClick and ULV_ItemLongClick events they didn't seem to fire. It must be something obvious but I don't see the problem.
I made a small testproject which resembles the situation.
Can you give it a look please?
 

Attachments

  • Testproject.zip
    16.5 KB · Views: 95

Informatix

Expert
Licensed User
Just scratching the surface of B4A I started exploring ULV. The overall performance and flexibility of ULV is really awesome.
However, when I wanted to use the ULV_ItemClick and ULV_ItemLongClick events they didn't seem to fire. It must be something obvious but I don't see the problem.
I made a small testproject which resembles the situation.
Can you give it a look please?
The selectable parameter in your AddLayout and AddRowLayout is set to False.
 

IDDGroup

Member
Licensed User
Im having this Problem with not being able to find journal.tmp happens only in debug mode, ok in release. I can use

I am successfully using ULV, when the user taps on a row, i start a new activity that also uses ULV. thats where its a problem.

If i clean the app, then close and restart B4A, it works ONCE. then every other time (including stopping and restarting the app) it gives:

Invalid path:
Error occurred on line: 55 (showregister)
java.io.FileNotFoundException: /journal.tmp (Read-only file system)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:308)
at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
....

Im assuming its something im not doing right, but i cant figure it out for the life of me.
 

Informatix

Expert
Licensed User
Im having this Problem with not being able to find journal.tmp happens only in debug mode, ok in release. I can use

I am successfully using ULV, when the user taps on a row, i start a new activity that also uses ULV. thats where its a problem.

If i clean the app, then close and restart B4A, it works ONCE. then every other time (including stopping and restarting the app) it gives:

Invalid path:
Error occurred on line: 55 (showregister)
java.io.FileNotFoundException: /journal.tmp (Read-only file system)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:308)
at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
....

Im assuming its something im not doing right, but i cant figure it out for the life of me.
Journal.tmp is not related to ULV but to the Cache library. Are you sure that you do not clean the cache (or any folder that you defined to hold the cache files) of your app while using it ?
 

IDDGroup

Member
Licensed User
no not at all.

its crashing on this line (ulv_reg is ultimate list view).

ULV_Reg.Initialize(50, 10, "", "ULV_Reg")

in release mode, it does execute that line.

if i want to set a cache, what goes in that "" field. i couldnt find any docs/examples of it.
 
Last edited:

IDDGroup

Member
Licensed User
Journal.tmp is not related to ULV but to the Cache library. Are you sure that you do not clean the cache (or any folder that you defined to hold the cache files) of your app while using it ?

I accidentally figured it out.. i figured i would post back incase anyone else runs into it.

I had copied some old code over to do the ULV in this app. i happen to notice while i was trying to figure this out, that i had a "DoEvents()" in there because it was doing a long list.

i noticed the warning that came up in the code that said something like "depreciated, may cause bad results, use sleep(0) if you need to"...

so i commented it out, put in a sleep(0) (although i dont even need it anyway).

sure enough, no more crashing.. i put the doevents back in, crashes with that journal.tmp missing, take it out. no crash.

so until proven otherwise, im blaming it on DoEvents. Do not use it.

--Karl
 
Top