Android Question NullPointerException

sultan87

Active Member
Licensed User
Longtime User
Hello,
I have a project that works fine in debug mode
in release mode I have this error message inadvertently
An error has occurred in sub:main_drawme(javaline:624)
java.lang.NullPointerException Continue?

Below is my code
B4X:
Sub drawMe(Canv As Canvas)
   
'    Msgbox("passage 1","anomalie")
   
'    drawBackground(Canv,"anomalie")

    If ExDraw <> Null Then
'            Msgbox("passage 2","anomalie")
        ExDraw.drawBitmap2(Canv, background, 0,0, backgroundPaint)
'            Msgbox("passage 3","anomalie")
        ExDraw.save2(Canv, ExDraw.MATRIX_SAVE_FLAG)
'            Msgbox("passage 4","anomalie")
        ExDraw.scale(Canv, scale, scale)
    End If
'    Msgbox("passage 5","anomalie")
'    drawmsgboxo(Canv,"anomalie")
    drawHand(Canv)
'    Msgbox("passage 6","anomalie")
    drawTemp(Canv)
'    Msgbox("passage 7","anomalie")   
    If ExDraw <> Null Then
        ExDraw.restore(Canv)   
    End If
   
'    Msgbox("passage 8","anomalie")
   
'    If handNeedsToMove Then
'        MoveHand
'    End If
   
'    handPosition = 25.2
       
    Panel1.Invalidate
End Sub
why?
best regards
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Is it possible that ExDraw has not been initialised and so it's failing on the not null check? If it has an IsInitialised method then I would check this first before continuing with the rest of the code in your function.
 
Upvote 0

sultan87

Active Member
Licensed User
Longtime User
Is it possible that ExDraw has not been initialised and so it's failing on the not null check? If it has an IsInitialised method then I would check this first before continuing with the rest of the code in your function.
hello,
thank's for your response
there is no method to IsInitialized exdraw
best regards
 
Upvote 0

wonder

Expert
Licensed User
Longtime User
How about the canvas object that you're passing? Was it set-up properly and initialized?
 
Upvote 0
Top