Fill a Custom List View with items using a custom layout

PaulMeuris

Active Member
Licensed User
The simple way to add items to a Custom List View is by using the AddTextItem method.
This method takes 2 arguments: a Text object and a Value object.
Usually the Text object is a string containing a name or some text composed of concatenated string pieces.
And the Value object contains an index for the listitem.
In this example you can learn how to use other elements in the Custom List View item line.
An image and a text label are added to a panel and that panel is then added to the Custom List View.
There are examples of 3 events: a Custom List View ItemClick event, an ImageView images_Click event and a Label titles_Click event.
These events each trigger a different action.
You can read the comments in the code to better understand what is going on.
Attached you can find the zip file of the clvtest project.
Happy coding!
Paul
Note: a Custom List View can replace a ScrollView in most cases.
 

Attachments

  • clvtest.zip
    88.6 KB · Views: 214

Branksey

Member
Licensed User
I downloaded the zip file and tried to run the project, but it doesn't build. I get the following error:

Error message:
B4A Version: 12.20

Parsing code.    (0.05s)
    Java Version: 11
Building folders structure.    (0.02s)
Running custom action.    Error
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                             
-------------------------------------------------------------------------------
  Started : 01 March 2024 06:48:18
   Source : C:\Users\David\DOWNLO~1\clvtest\Shared Files\
     Dest : C:\Users\David\DOWNLO~1\clvtest\B4A\Files\
    Files : *.*
        
  Options : *.* /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
2024/03/01 06:48:18 ERROR 2 (0x00000002) Accessing Source Directory C:\Users\David\DOWNLO~1\clvtest\Shared Files\
The system cannot find the file specified.

Any help would be greatly appreciated
 
Top