Having unbound Arrays of custom types

thedesolatesoul

Expert
Licensed User
Longtime User
I have a type declared:
B4X:
   Type TaskItemType ( _
      TaskType As Int, _ 
      ScheduledTime As Long, _
      DestPath As String, _    
      SourcePath As String, _        
)
Dim TaskItems() As TaskItemType

But when I try to initialise it from another code module
B4X:
Sub CreateTask(TaskType As Int, ScheduledTime As Long, SourcePath As String, DestPath As String, Filter As String)
   dpservice.TaskItems(dpservice.TotalQueItems).Initialize
   dpservice.TaskItems(dpservice.TotalQueItems).TaskType = TaskType
   dpservice.TaskItems(dpservice.TotalQueItems).ScheduledTime  = ScheduledTime 
   dpservice.TaskItems(dpservice.TotalQueItems).SourcePath = sourcepath
   dpservice.TaskItems(dpservice.TotalQueItems).DestPath  = DestPath

End Sub

I get an ArrayOutofBounds exception. Is it possible to do this at all?
 
Top