Android Question initialize error for list

saeed10051

Active Member
Licensed User
Hi, i am declaring a list in Process sub global and initializing it in Sub Activity_Create(FirstTime As Boolean)
List1.Initialize
List1.AddAll(Array As Int(1, 2, 3, 4, 5,6,7,8,9,10))

if i run following code in activity create, it runs fine
For i = 0 To 9
Log(List1.Get(i))
Next

however if i try to call this list in a sub by following code
Dim num2 as int
num2 = List1.Get(0)
i get following error
java.lang.RuntimeException: Object should first be initialized (List).
this list is already initilized in the create_actvity, i just dont understand where i am going wrong.
 

DonManfred

Expert
Licensed User
1. Please use CODE tags when posting code.

however if i try to call this list in a sub by following code
a sub in the same activity?

Please provide more informations. Best is to upload a small project which shows the issue.
Use File->Export as zip to export it. Upload this zip here
 
Last edited:

saeed10051

Active Member
Licensed User
1. Please use CODE tags when posting code.


a sub in the same activity?

Please provide more informations. Best is to upload a small project which shows the issue.
Use File->Export as zip to export it. Upload this zip here
Hi DonManfred
here is the zip file, when i am running this one it is running fine and giving me exactly what i want. however same code in another bigger program is not working and giving me the error listed above. Actually i am trying to shuffle the numbers list using the code written by you. i just dont know where it is going wrong in my other program file.
 

Attachments

saeed10051

Active Member
Licensed User
If it works in the small project then there is a different problem in your large project. Without seeing more code it is difficult to say anything else.
Thanks Erel, i have figured it out, it was because of a timer event which was triggering at the time of loading the layout.
 
Top