Android Question Canvas.drawbitmap() Null pointer

Bill Kantz

Member
Licensed User
Fixed: didn;t realize the DestRect could not be Null


I have been banging my head on this one. c.DrawBitmap(d,Null,Null) keeps getting a Null Pointer error .


B4X:
Dim c As Canvas
Dim b,d As Bitmap
Dim bout As OutputStream
 
tr.Initialize(File.OpenInput(File.DirInternal,"RADAR.txt"))
Station = tr.ReadLine
tr.Close
 
b.InitializeMutable(600,550)
c.Initialize2(b)
    
d.Initialize(File.DirInternal, Station & "_Topo_Short.jpg")
c.DrawBitmap(d,Null,Null)
B4X:
java.lang.NullPointerException
    at android.graphics.Canvas.drawBitmap(Canvas.java:1125)
    at anywheresoftware.b4a.objects.drawable.CanvasWrapper.DrawBitmap(CanvasWrapper.java:242)
    at com.sailawayapps.bestwx.inapp.radar._activity_resume(radar.java:361)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
    at com.sailawayapps.bestwx.inapp.radar.afterFirstLayout(radar.java:104)
    at com.sailawayapps.bestwx.inapp.radar.access$100(radar.java:16)
    at com.sailawayapps.bestwx.inapp.radar$WaitForLayout.run(radar.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4777)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
    at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Service (ws) Start **
** Service (ws) Start **
** Service (ws) Start **
** Service (ws) Start **
** Service (ws) Start **
** Service (ws) Start **
 
Last edited:
Top