Android Question java.lang.RuntimeException: Object should first be initialized (ListView)

Majo03

New Member
I have this error

B4X:
java.lang.RuntimeException: Object should first be initialized (ListView).

in this sub

B4X:
Sub Carga_BD_en_ListViewContactos
    ' Limpia el ListView1
    ListViewContactos_TEMJ.Clear
    ' Carga la tabla usuarios de la basedatos.sql
    registro = SQL1.ExecQuery("SELECT * FROM contactos")

    For n = 0 To registro.RowCount - 1
        registro.Position = n
        ListViewContactos_TEMJ.AddSingleLine(registro.GetString("id") & "|" & registro.GetString("nombre")& " - " & registro.GetString("telefono"))
        ListViewContactos_TEMJ.SingleLineLayout.ItemHeight = 40
        ListViewContactos_TEMJ.SingleLineLayout.Label.TextSize = 20
        ListViewContactos_TEMJ.SingleLineLayout.Label.TextColor = Colors.Black
        ListViewContactos_TEMJ.SingleLineLayout.Label.Color = Colors.White
    Next
End Sub

and these are my variables

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created
    Dim registro As Cursor
    Dim nombre, telefono As String
    Dim id As String

    Private btnIrAgenda_MJTE As Button
    Private txtNombre_TEMJ As EditText
    Private txtTelefono_TEMJ As EditText
    Private ListViewContactos_TEMJ As ListView
    Private btnAgregarContacto_TEMJ As Button
    Private btnBorarContacto_TEMJ As Button
End Sub
 
Top