Android Question List is empty after having listed all the items

DALB

Active Member
Licensed User
hello,

in a B4Xpages, I have this little code:

listing items of a list:
    Log("starter.list-----------")
    For u=0 To Starter.list.Size-1'Starter.list.Size-1
        Log("starter.list.get(" & u &  ") = " & Starter.list.Get(u))
    Next

'list' is declared and initialized in starter module.

But when it's running, an error comes with this line:
java.lang.RuntimeException: Object should first be initialized (List).

But, I code only in B4Xpages. Why this error ?
With Activity, I initialize, but here, what can I do ?
Something escapes from my reason !!!
 

Alexander Stolte

Expert
Licensed User
Longtime User
'list' is declared and initialized in starter module.
Why?

But when it's running, an error comes with this line:
Then check first whether the list has been initialized. Nobody can help you here, because nobody knows what your starter service looks like, how you initialize and fill the list.
 
Upvote 1

DALB

Active Member
Licensed User
I'll read again the different informations about B4Xpages, the only thing I can't arrive to do is sending datas from a B4Xpages to another. Systematically, I have this error "....not initialized" !!!

Thanks for answering.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Do you mean that you have created a List object called "list". I cannot check it now but that seems a bad idea. Try calling it something else.

Edit : I have had time to check this now - it does seem to work. But I still think that it is bad practice.
 
Last edited:
Upvote 0

josejad

Expert
Licensed User
Longtime User
I code only in B4Xpages
So, as Erel said, there’s no need to use starter service, but B4XMainPage, that’s why Alexander is asking you.

And probably Brian is rigth too… using a reserved word as a variable name is not a good idea.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The threadtitle is wrong. You have NOT added items to this list as the list is not initialized.
The problem is somewhere else.

Post a small project showing the problem.
 
Upvote 0
Top