B4A Library [Lib] UltimateListView

Informatix

Expert
Licensed User
Longtime User
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
Longtime 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
Longtime User
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
Longtime 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 )

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
Longtime 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
Longtime 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: 296

Informatix

Expert
Licensed User
Longtime User
The selectable parameter in your AddLayout and AddRowLayout is set to False.
 

IDDGroup

Member
Licensed User
Longtime 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
Longtime 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 ?
 

IDDGroup

Member
Licensed User
Longtime 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
Longtime 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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…