Android Question ListView add item

Serge Bertet

Active Member
Licensed User
Longtime User
Hello,

I use xCustomListView V1.63

B4X:
Sub Globals
   ...
   Private lv As CustomListView
   ...
End Sub

Sub fill_listview
Dim p As Panel
            p.Initialize("")
            p.SetLayout(0dip, 0dip, 160dip, 80dip)
            p.LoadLayout("CellItem")
            Label1.Text = csr.GetString("sometext")
            lv.Add(p, "Item")
End Sub

"CellItem" design contains only 1 label

I get this when compiling:
error: incompatible types: ViewGroup cannot be converted to B4XViewWrapper

Serge
 

Serge Bertet

Active Member
Licensed User
Longtime User
I switched back to CustomListView V1.76 even if deprecated (but working), so I have no code source any more.
I'll try to make an other project as example and post it here.
To upload a project should I use the "file->export to zip" command?
Thx for your help.
"CustonListView deprecated" what it means, compatibulity problems or other?
Serge
 
Upvote 0

Serge Bertet

Active Member
Licensed User
Longtime User
Here is a example project.
still this error: incompatible types: ViewGroup cannot be converted to B4XViewWrapper
pointing the CLV.add line
For sure I forget something ... yesterday spent 3 hours on that.
Some are using GUI library, actually I don't know why that do not work

xCustomListView V1.63
B4A v8.30
 

Attachments

  • CLV_test.zip
    10.1 KB · Views: 416
Upvote 0

klaus

Expert
Licensed User
Longtime User
You need to check the XUI library:

upload_2018-8-5_12-52-57.png


And replace
Private Label1 As Label
by
Private Label1 As B4XView
 
Upvote 0

Serge Bertet

Active Member
Licensed User
Longtime User
Many thanks klaus,
That's working great like that
As I can say this information is well hiden ... or I'm missing to look somewhere.

Serge
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I had a look at the xCustomView demo project.
I tried Serge's project after implementing your suggestions, but nothing appears in the activity title when I use this code:
B4X:
Sub clv_ItemClick (Index As Int, Value As Object)
            Activity.Title = Value
            CLV.AsView.BringToFront
End Sub

EDIT: The problem is: He has this line in his code:
B4X:
CLV.Add(AddItem("Item" & i), "")
 
Last edited:
Upvote 0
Top