Hi Community I'm translating my app from B4a to B4j.
I'm having problems replicating the loading functions in an xCustomListView in b4j. How can I translate this code into b4j?
I'm having problems replicating the loading functions in an xCustomListView in b4j. How can I translate this code into b4j?
B4a CODE:
'B4a CODE
Sub CreateListItemMessage(Nome1 As String, nrcell As String, email As String, testo As String,Date1 As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.SetLayout(0,0%y,Width,Height)
p.LoadLayout("Layout_Set_Kunde")
p.Color= Colors.White
p.Elevation=3dip
'
Dim set As ColorDrawable
set.Initialize2(Colors.Transparent,0,0,Colors.White)
LName.Initialize("")
LName.Width=100%x
LName.TextColor=Colors.Green
LName.TextSize=15
LName.SingleLine=True
LName.Text=Nome1
'LName.Gravity= Bit.Or(Gravity.CENTER_HORIZONTAL,Gravity.CENTER_VERTICAL)
p.AddView(LName,7%x,2%y,30%x,4%x)
Dim set As ColorDrawable
set.Initialize2(Colors.Transparent,0,0,Colors.White)
LPhone.Initialize("")
LPhone.Width=100%x
LPhone.Background=set
LPhone.TextColor=Colors.Blue
LPhone.TextSize=15
LPhone.SingleLine=True
LPhone.Text=nrcell
'LPhone.Gravity= Bit.Or(Gravity.CENTER_HORIZONTAL,Gravity.CENTER_VERTICAL)
p.AddView(LPhone,7%x,5%y,21%x,4%x)
Dim set As ColorDrawable
set.Initialize2(Colors.Transparent,0,0,Colors.White)
LMail.Initialize("")
LMail.Width=100%x
LMail.Background=set
LMail.TextColor=Colors.LightGray
LMail.TextSize=15
LMail.SingleLine=True
LMail.Text=email
'LMail.Gravity= Bit.Or(Gravity.CENTER_HORIZONTAL,Gravity.CENTER_VERTICAL)
p.AddView(LMail,7%x,8%y,30%x,4%x)
Dim set As ColorDrawable
LMessage.Initialize("")
LMessage.SingleLine=False
LMessage.Width=100%x
LMessage.TextColor=Colors.Gray
LMessage.TextSize=15
LMessage.SingleLine=False
LMessage.Text=testo
'LMessage.Gravity= Bit.Or(Gravity.CENTER_HORIZONTAL,Gravity.CENTER_VERTICAL)
p.AddView(LMessage,7%x,13%y,70%x,40%x)
Dim set As ColorDrawable
Ldate.Initialize("")
Ldate.SingleLine=False
Ldate.Width=100%x
Ldate.TextColor=Colors.Gray
Ldate.TextSize=15
Ldate.SingleLine=False
Ldate.Text=Date1
'LMessage.Gravity= Bit.Or(Gravity.CENTER_HORIZONTAL,Gravity.CENTER_VERTICAL)
p.AddView(Ldate,37%x,2%y,70%x,4%x)
Return p
End Sub
Sub Load_ItemUser_Message
Log("Load_Message")
CustomListViewMessaggio.Clear
For i = 0 To List_ID.Size-1
CustomListViewMessaggio.Add(CreateListItemMessage(List_Nome.Get(i),List_Phone.Get(i),List_Mail.Get(i),List_Message.Get(i),List_Date.Get(i),85%x,40%y),List_ID)
Next
End Sub