Spanish java.lang.RuntimeException: Object should first be initialized.

wilson09001

New Member
Buenas noches
tengo una pregunta lo que sucede es que me aparece este error


Region Activity Attributes
#FullScreen: True
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim mySQL As SQL
Dim myCUR As Cursor

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.

Dim N As SQL
Dim CF As Cursor
Private qry As String
Public FirstTimeMain As Boolean

Dim Flag_actualizar As Boolean = False

Private VARIABLE As EditText
Private LIMPIAR As Button
Private GUARDAR As Button
Private ListView1 As ListView
Private Potencia As EditText
Dim ID As Int

End Sub

Sub ConnectionDB

Dim ConDB As String
ConDB =DBUtils.CopyDBFromAssets("BASEDEDATOS.db") 'contacs_db = database name
N.Initialize(ConDB, "BASEDEDATOS.db", True)




If FirstTimeMain Then
If File.Exists(File.DirInternal,"BASEDEDATOS.db") = False Then
File.Copy(File.DirAssets,"BASEDEDATOS.db", File.DirInternal, "BASEDEDATOS.db")
End If
End If
N.Initialize(File.DirInternal,"BASEDEDATOS.db",True)
qry="select * FROM datos"
Private Rs As ResultSet = N.ExecQuery(qry)
Do While Rs.NextRow
VARIABLE.Text=VARIABLE.Text & Rs.GetString("VARIABLE") & CRLF
Loop


Log("Cantidad de registros: "&N.ExecQuerySingleResult("select * FROM datos"))

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("pant")
Activity.Title="BASE DE DATOS"

ListView1.TwoLinesLayout.Label.TextColor = Colors.Black
ListView1.TwoLinesLayout.Label.TextSize = 20
ListView1.TwoLinesLayout.SecondLabel.TextColor = Colors.Black
ListView1.TwoLinesLayout.SecondLabel.TextSize = 16


Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)

Wait For Activity_PermissionResult (Permission As String, PResult As Boolean)
If PResult = True Then
'MsgboxAsync("No permission to access external storage", "")
'Return False
End If
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, PResult As Boolean)
If PResult = True Then
'MsgboxAsync("No permission to access external storage", "")
'Return False

End If

GUARDAR_Click
End Sub



Sub Activity_Resume



End Sub

Sub Activity_Pause (UserClosed As Boolean)


End Sub




Private Sub List_ItemClick (Position As Int, Value As Object)




End Sub





Private Sub GUARDAR_Click


If VARIABLE.Text = "" Then
Msgbox("NO HA METIDO NADA", "Advertencia")
Return False
End If

If Potencia.Text = "" Then
Msgbox("NADA", "Advertencia")
Return False
End If
N.ExecQuerySingleResult("UPDATE datos SET RPM='"& VARIABLE.Text)


End Sub

Private Sub LIMPIAR_Click




End Sub
estoy batallando con esto lo eh inicializado varias veces
 

Mariano Ismael Castro

Active Member
Licensed User
1- No veo en que momento llamas a esta función (Es la que inicializa).
2- No se recomienda usa Cursor

Te recomiendo que subas un ejemplo que demuestre tu error y te recomiendo usar B4XPages
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Hola Wilson, bienvenido.

Además de lo que indica Mariano, ten en cuenta un par de reglas del foro.

Pega los errores como texto, no como imágenes.

Pega el código (y también los errores) entre etiquetas [code].... tu código aquí ... [/code]. Lo hará todo más legible y sencillo.

Y la manera más fácil de ayudarte, que subas un proyecto como dice Mariano para poder ver el código y probar.

saludos,
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…