Android Question Customlistview

Tjitte Dijkstra

Member
Licensed User
Longtime User
I used the example code Customlistview and it worked fine.
Then I used a variable of my own of type Customlistview, but I got an error:

Error description: Unknown type: customlistview
Are you missing a library reference?

I am using library
Reflection(2.4)
StringUtils(1.02)

What error do I make?
 

CanguroCode

Active Member
Licensed User
Longtime User
Can you upload your project? Customlistview is not a library, is a class from Erel, so you must add it to you project.
 
Upvote 0

Tjitte Dijkstra

Member
Licensed User
Longtime User
The error does not show up in the code. Already in the Sub Globals I am asked "are you missing a library reference?".


Sub Globals
Dim NAMENLIJST As CustomListView
 
Upvote 0

Tjitte Dijkstra

Member
Licensed User
Longtime User
Tnx so far.
Is there a step by step schedule to add the CustomListView?
I added the CustomListView.bas to the directory of my app, but that seems not enough.
What else (besides of course Project / add existing module / load CustomListView) should I do?
 
Upvote 0

Tjitte Dijkstra

Member
Licensed User
Longtime User
Of course I did what I had to do: Project / add existing module / load CustomListView
What happened next?

Sub Globals
Dim NAMENLIJST As CustomListView 'this is excepted 'NAMENLIJST is Dutch for ListOfNames
Dim Teller as int
But in the Sub Activity_Create an error is found

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
Teller = 1
NAMENLIJST.Initialize(Me, "NAMENLIJST")
Activity.AddView(NAMENLIJST.AsView, 0, 50%y, 100%x, 50%y) 'So far so good
NAMENLIJST.Add(CreateListItem("Item #" & teller, NAMENLIJST.AsView.Width, 50dip), 50dip, "Item #" & teller)

The last line of code gets an error:

Error parsing program.
Error description: Undeclared variable 'createlistitem' is used before it was assigned any value.
 
Upvote 0

CanguroCode

Active Member
Licensed User
Longtime User
The error is in CreateListItem and is a function that you have to create. Check again the example of Erel there that function appears. Does you have implemented your code?
It is easier for us to help you if you upload your project or if you use the [code] [/code] labels with the full code and if upload the full log.

Check this link:

https://www.b4x.com/android/forum/threads/how-to-ask-a-question.9140/
 
Last edited:
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Upvote 0

Tjitte Dijkstra

Member
Licensed User
Longtime User
Thnx to all of you.
Step by step I start to understand the secrets of b4a. You have to see the difference between program-code / modules / classes and how to handle them. (I made a checklist for my own and hope not to forget the right steps.)
When I was young, I worked with Turbo Pascal and Delphi. In those languages you mainly work with units in which you can write your own procedures that can be used in any other program.
b4a feels excellent, but my learning curve is not that steep as it was in the past.
Bye! ;)
 
Upvote 0
Top