Android Question Returning a list of views problem

AbbasMohammed

Member
Licensed User
Longtime User
Dears,
Kindly, i need to return a list that contains 2 views to disply it on ScrlPagethat belongs to a parent Class method which is PageShow as below:
B4X:
Public Sub PageShow
'    Msgbox("Iam Page :" & PageId &" With MainProducts : " & MainProductList,PageName)
    PageHide
    AddViews
    Dim Ivlist As List
    Dim MpIv As ImageView:Dim Mpl As Label
    Main.BackConstant =-1000
    PageTitle.Text =PageName
    ScrlPage.Panel.Height =ScrlHight
    ScrlPage.ScrollPosition=0
     For i=0 To MainProductList.Size-1
    Ivlist=MainProduct(i).GetMainProd
    MpIv=Ivlist(0):Mpl=Ivlist(1)
    ScrlPage.Panel.AddView (MpIv,MpIv.Left ,MpIv.Top ,MpIv.Width ,MpIv.Height )
    ScrlPage.Panel.AddView (Mpl,Mpl.Left ,Mpl.Top ,Mpl.Width ,Mpl.Height )
    Next
End Sub
by using GetMainProd method which belongs to child class as below:
B4X:
Public Sub GetMainProd ()
    Dim AV1 As ImageView:Dim AV2 As Label
    Dim ViewList As List
    If ProductPostion >= 0 Then
    ProdImagView.Initialize ("IV")
    ProductLable.Initialize ("IV")
    ProdImagView.Bitmap=LoadBitmap(File.DirAssets ,"1.jpg")
    ProdImagView.Gravity =Gravity.fill
    ProdImagView.Tag =ProductId
    ProductLable.Tag =ProductId+1000
    ProductLable.Text=ProductName
    ProductLable.Gravity =Gravity.CENTER
    ProductLable.TextSize=2%x
    ProductLable.TextColor=Colors.Red
    If Fav=1 Then
    ProductLable.color=Colors.RGB(255,255,175)
    Else
    ProductLable.color=Colors.Transparent
    End If
    AV1=ProdImagView:AV2=ProductLable
    AV1.Left =ProductColumn:AV1.Top =ProdRow:AV1.Width =33%x:AV1.Height=33%x
    AV2.Left=ProductColumn:    AV2.Top=ProdRow+33%x:    AV2.Width =33%x:    AV2.Height=22%x
    End If
    ViewList.Add(AV1):ViewList.Add(AV2)
    Return ViewList
End Sub

but i get the following error

Parsing code. 0.02
Compiling code. 0.02
Compiling layouts code. 0.00
Generating R file. 0.01
Compiling generated Java code. Error
B4A line: 78
Ivlist=MainProduct(i).GetMainProd
javac 1.7.0_71
src\abbscroll\abbscroll\page.java:312: error: inconvertible types
_ivlist = (anywheresoftware.b4a.objects.collections.List[])(_mainproduct[_i]._getmainprod());
^
required: List[]
found: String
1 error
 

AbbasMohammed

Member
Licensed User
Longtime User
its very strange but the error is changed to
Parsing code. Error
Error parsing program.
Error description: Use of undeclared array: ivlist
Occurred on line: 78
MpIv=Ivlist(0):Mpl=Ivlist(1)
 
Upvote 0

AbbasMohammed

Member
Licensed User
Longtime User
i did it but i still get the following:

Parsing code. Error
Error parsing program.
Error description: Use of undeclared array: ivlist
Occurred on line: 78
MpIv=Ivlist(0):Mpl=Ivlist(1)
 
Upvote 0
Top