Android Question Error java.lang.ref.WeakReference.get()

Argencom

New Member
Licensed User
Longtime User
hello to all, when executing the following code, I get the error: java.lang.NullPointerException: Attempt to invoke virtual method java.lang.Object java.lang.ref.WeakReference.get() on a null object reference

B4X:
Sub Activity_ActionBarHomeClick
    Try
        CerrarActividad
    Catch
        ToastMessageShow ("Error interno. Intentelo nuevamente",True)
        DatosLocales.GrabarLogError("Preventa", "Activity_ActionBarHomeClick", LastException.Message, Utiles.fecha, Utiles.hora)
        Activity.Finish
        StartActivity("Inicio")
    End Try
End Sub

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
    Try
        Select KeyCode
            Case KeyCodes.KEYCODE_BACK
                CerrarActividad
        End Select     
    Catch
        ToastMessageShow ("Error interno. Intentelo nuevamente",True)
        DatosLocales.GrabarLogError("Preventa", "Activity_KeyPress", LastException.Message, Utiles.fecha, Utiles.hora)
        Activity.Finish
        StartActivity("Inicio")
    End Try
End Sub



Private Sub CerrarActividad
    Try
        Dim sf As Object = Msgbox2Async("Se perderán los cambios. Confirma?", "Movint", "Si", "", "No", Null, False)
        Wait For (sf) Msgbox_Result (Result As Int)
        If Result = DialogResponse.POSITIVE Then
            If DatosLocales.origen_cliente <> "habitual" Then
                s.ExecNonQuery("DELETE FROM VENTA_NUEVO_CLIENTE WHERE COD_CLIENTE='" & NuevoCliente.codCliente & "'")
            End If
      
            Activity.Finish
            StartActivity("ClientesPreventa")
        End If
    Catch     
        DatosLocales.GrabarLogError("Preventa", "CerrarActividad", LastException.Message, Utiles.fecha, Utiles.hora)
    End Try 
End Sub

From now, thank you for you help.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
This is the english part of the forum. Please write english here.

Additionally you should post the full error.

Please use [CODE]code here...[/CODE] tags when posting code.

codetag001.png

codetag002.png

codetag003.png
 
Upvote 0
Top