Android Question [Solved - Stupidity] Can I add a List to a Custom Type?

agraham

Expert
Licensed User
Longtime User
I'm probably suffering brain fade but I want to do the following
B4X:
Type ViewInfo(ViewName As String, ViewType As String, HasText As Boolean, ViewText As String, ViewParent As String, ViewChildren() As List)
'... 
Sub CreateViewInfo (ViewName As String, ViewType As String, HasText As Boolean, ViewText As String, ViewParent As String, ViewChildren As List) As ViewInfo
    Dim t1 As ViewInfo
    t1.Initialize
    t1.ViewName = ViewName
    t1.ViewType = ViewType
    t1.HasText = HasText
    t1.ViewText = ViewText
    t1.ViewParent = ViewParent
    t1.ViewChildren = ViewChildren
    Return t1
End Sub
'...
    Dim lblinfo As ViewInfo
    Dim Children As List
    Children.Initialize
  
    lblinfo = CreateViewInfo(ViewName, ViewType, HasText, ViewText, "", Children)
However I get a compilation error!
src\b4a\agraham\basicidedesigner\draggableview.java:158: error: incompatible types: java.util.List<Object> cannot be converted to anywheresoftware.b4a.objects.collections.List[]
_t1.ViewChildren /*anywheresoftware.b4a.objects.collections.List[]*/ = (anywheresoftware.b4a.objects.collections.List[])(_viewchildren.getObject());
Can this be done?
 
D

Deleted member 103

Guest
I unwittingly defined ViewInfo.Children as an array. I though that I had fixed that but possibly a few too many Ctl-Shift-Zs and fatigue caused the problem. I'd better give up for the day!
i do it like this.
if I see the problem cannot be closed after a few hours, then I switch off my PC. After a break or the next day, I keep going and I can get the same problem a lot faster and better. ;)
 
Upvote 0

Unobtainius

Active Member
Licensed User
Longtime User
It happens to all of us. Maybe more than we like to admit. Thanks for sharing and keeping it real
 
Upvote 0
Top