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
Thanks for your wonderful support :)
I have this working well and the mp3's are playing etc.
Now I'm dealing with an issue I thought you could point me to a solution quickly.
When the user touches a view/panel in the ULV, and they accidentally slide it up or down a few pixels, it fires the scrolled event.
is there a simple way to determine if the scroll was incidental (very few pixels of movement) or if it was intentional (scrolled a whole panel or more)?
Thanks,
Rusty
In this case, I let the system decide (each device has its own settings to detect a scroll). However, you can use the Touch event and do the computation between the current Y and the previous Y. You can block the scroll by returning True.
 

Rusty

Well-Known Member
Licensed User
Longtime User
Nice move donating to the doctors!

To all those who are interested: this library is very functional; Informatix' support is excellent; the documentation is very well done and the examples are superb!

I wish all paid for libraries were as well documented and supported.
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
In this case, I let the system decide (each device has its own settings to detect a scroll). However, you can use the Touch event and do the computation between the current Y and the previous Y. You can block the scroll by returning True.
Ok, i put the calculation in the UlistView_ItemTouch(Position As Int, Action As Int, X As Int, Y As Int, TouchedPanel As Panel) event.
when I return TRUE, the compiler complains about the sub not having a return value type.
Should I be returning True from within the itemtouch event?
Rusty
 

TheMightySwe

Active Member
Licensed User
Longtime User
Hi, is it possible to drag and drop between two UltimateListViews?

(I know you probably can, but i just want to be sure)

// TMS

AH screw it, it looks great, Just made the donation.

89123214UN388791L
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
Ok, i put the calculation in the UlistView_ItemTouch(Position As Int, Action As Int, X As Int, Y As Int, TouchedPanel As Panel) event.
when I return TRUE, the compiler complains about the sub not having a return value type.
Should I be returning True from within the itemtouch event?
Rusty
It's the Touch event of the list:
Sub ULV_Touch(Action As Int, X As Int, Y As Int, MotionEvent As Object) As Boolean
Use Space+Tab after Sub in the IDE to see all events for ULV.
 

Informatix

Expert
Licensed User
Longtime User
Hi, is it possible to drag and drop between two UltimateListViews?

(I know you probably can, but i just want to be sure)

// TMS

AH screw it, it looks great, Just made the donation.

89123214UN388791L
Yes, that works between two ULV. When the item is dropped on the second ULV, you have to insert a new item in this ULV. The problem is to know exactly what's the insertion position.

Thank you for your donation.
 

TheMightySwe

Active Member
Licensed User
Longtime User
Yes, that works between two ULV. When the item is dropped on the second ULV, you have to insert a new item in this ULV. The problem is to know exactly what's the insertion position.

Thank you for your donation.


That is not a problem, I just insert it at the bottom.
 

aaronk

Well-Known Member
Licensed User
Longtime User
Just wondering is the ULV supported on Android 5.0 Lollipop ?
I seem to keep getting the following error, but I don't get this error when running the same code on Android 4.4.4. KitKat:

B4X:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setAlpha(int)' on a null object reference
    at flm.b4a.scrollview2d.EdgeEffect.draw(EdgeEffect.java:320)
    at flm.b4a.scrollview2d.TwoDScrollView.draw(TwoDScrollView.java:1967)
    at android.view.View.draw(View.java:15022)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15117)
    at android.view.View.draw(View.java:15022)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15017)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15017)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15117)
    at android.widget.FrameLayout.draw(FrameLayout.java:592)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2595)
    at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2606)
    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2519)
    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2337)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1968)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

On Android 5.0 Lollipop, if I scroll down the list it comes up with the above error in the B4A IDE Log, but the app closes and says Unfortunately app has stoped, without telling me in my code where the error is.

I am guessing it's within the ULV code where the error is?

Any ideas on how to fix it so it doesn't crash the app ?
 

Informatix

Expert
Licensed User
Longtime User
Just wondering is the ULV supported on Android 5.0 Lollipop ?
I seem to keep getting the following error, but I don't get this error when running the same code on Android 4.4.4. KitKat:

B4X:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setAlpha(int)' on a null object reference
    at flm.b4a.scrollview2d.EdgeEffect.draw(EdgeEffect.java:320)
    at flm.b4a.scrollview2d.TwoDScrollView.draw(TwoDScrollView.java:1967)
    at android.view.View.draw(View.java:15022)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15117)
    at android.view.View.draw(View.java:15022)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15017)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15017)
    at android.view.ViewGroup.drawChild(ViewGroup.java:3404)
    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
    at android.view.View.draw(View.java:15117)
    at android.widget.FrameLayout.draw(FrameLayout.java:592)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2595)
    at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2606)
    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2519)
    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2337)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1968)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

On Android 5.0 Lollipop, if I scroll down the list it comes up with the above error in the B4A IDE Log, but the app closes and says Unfortunately app has stoped, without telling me in my code where the error is.

I am guessing it's within the ULV code where the error is?

Any ideas on how to fix it so it doesn't crash the app ?
I received your email so there's no need to post also here. Reminder for everyone: I provide support only from monday to friday for ULV, so every email received at the end of the week won't get an answer before monday.

Your error message concerns ScrollView2D, so you are probably using a very old version of ULV, when ULV was a class written in B4A and based on ScrollView2D. You should update it. I sent you the link to the last version (4.01) at the beginning of this month.
I tested ULV with Lollypop and it is compatible at 99.99% (the only issue is the same as with the L preview: the fastscroller state cannot be read, which is a minor inconvenience).

Concerning the special version of Scrollview2D delivered with the former versions of ULV, it won't get updated. To use a compatible version, get the version 1.1 available in the B4A forum.
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
An user reported a strange issue with Turkish language and ULV. It seems that Android fails to convert some letters (e.g. i) to uppercase and that produces an issue with layouts. An easy fix is to convert yourself all your layout names in uppercase.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This issue is related to the Turkish 'I' character being converted to a character other than 'i'. The solution is to never use String.ToLowerCase() or String.ToUpperCase().

Instead use String.ToLowerCase(BA.cul) or ToUpperCase(BA.cul).

Note that is not related to Android. It will happen in any language or environment.
 

Informatix

Expert
Licensed User
Longtime User
This issue is related to the Turkish 'I' character being converted to a character other than 'i'. The solution is to never use String.ToLowerCase() or String.ToUpperCase().

Instead use String.ToLowerCase(BA.cul) or ToUpperCase(BA.cul).

Note that is not related to Android. It will happen in any language or environment.
In my Java code, I use toUpperCase(BA.cul) most of the time, except in some functions. That will be fixed in a future version.
 

Informatix

Expert
Licensed User
Longtime User
How to use the RippleEffect library with ULV:

Add the initialization code at the end of the LayoutCreator sub, e.g.:
B4X:
Dim rv As RippleView
rv.Initialize(CellPanel, Colors.Blue, 200, False)

And treat the RippleView as an extra panel in the ContentFiller sub, e.g.:
B4X:
Dim pnlRipple As Panel = CellPanel.GetView(0)
Dim lbl As Label = pnlRipple.GetView(0)
 

cimperia

Active Member
Licensed User
Longtime User
A quick word to show my appreciation. I got the ULV library a week or so ago. It's very fast, well documented and very rich in functionality.
Furthermore Frederic's responsiveness is second to none: I've contacted him with a few issues I was having and the answer was always fast and the problem sorted.

Claudio
 

shashkiranr

Active Member
Licensed User
Longtime User
Hi Fred,

Getting a Null pointer exception when i add the following lines in my layoutcreator sub

B4X:
Dim rv As RippleView
        rv.Initialize(LayoutPanel, Colors.Blue, 200, False)

Regards,
SK
 
Top