Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui1 As XUI
Type resultadoControle (lbCEP As Label, lbCidade As Label, lbLogradouro As Label)
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private btnNovaPesquisa As Button
Private lvwPesquisaResultado As CustomListView
Private lbCEP As B4XView
Private lbCidade As B4XView
Private lbLogradouro As B4XView
Private lbUF As B4XView
Private lbComplemento As B4XView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("pesquisa_resultado_layout")
' Verifica se há ítens na lista.
If CepDoEndereco.pesquisaResultado <> Null And CepDoEndereco.pesquisaResultado.IsInitialized Then
Dim pesquisaResultado As List = CepDoEndereco.pesquisaResultado
lvwPesquisaResultado.Clear
For Each viaCepTipo1 As ViaCepTipo In pesquisaResultado
Dim objpn As B4XView
objpn = xui1.CreatePanel("pnl")
objpn.SetLayoutAnimated(0, 0, 0, 100%x, 100dip)
objpn.LoadLayout("endereco_detalhe_layout")
Dim resultadoControle1 As resultadoControle
resultadoControle1.Initialize
resultadoControle1.lbCEP = lbCEP
resultadoControle1.lbCidade = lbCidade
resultadoControle1.lbLogradouro = lbLogradouro
resultadoControle1.lbCEP.Text = viaCepTipo1.cep
resultadoControle1.lbCidade.Text = viaCepTipo1.localidade
resultadoControle1.lbLogradouro.Text = viaCepTipo1.logradouro
' The error ocurred on the line below.
lvwPesquisaResultado.Add(objpn, resultadoControle1)
Next
End If
End Sub