Android Question Customlistview

Discussion in 'Android Questions' started by Tjitte Dijkstra, Apr 21, 2015.

  1. Tjitte Dijkstra

    Tjitte Dijkstra Member Licensed 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?
     
  2. CanguroCode

    CanguroCode Active Member Licensed User

    Can you upload your project? Customlistview is not a library, is a class from Erel, so you must add it to you project.
     
  3. Tjitte Dijkstra

    Tjitte Dijkstra Member Licensed 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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Have you added CustomListView class module to your project?
     
  5. Tjitte Dijkstra

    Tjitte Dijkstra Member Licensed 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?
     
  6. NJDude

    NJDude Expert Licensed User

    That's how you add modules to your project, not by only copying it.
     
  7. Tjitte Dijkstra

    Tjitte Dijkstra Member Licensed 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.
     
  8. CanguroCode

    CanguroCode Active Member Licensed 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:

    http://www.b4x.com/android/forum/threads/how-to-ask-a-question.9140/
     
    Last edited: Apr 23, 2015
  9. mangojack

    mangojack Well-Known Member Licensed User

    That should be ... [code] Insert code here ... [/code]
     
  10. CanguroCode

    CanguroCode Active Member Licensed User

    True thanks, my mistake. Corrected entry
     
  11. Tjitte Dijkstra

    Tjitte Dijkstra Member Licensed 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! ;)
     
    RandomCoder likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice