Canvas.DrawBitmap not working?

MaxApps

Active Member
Licensed User
Longtime User
Hi

I am trying to use Canvas.Drawbitmap, but when using the tutorial example, I get an error (java.lang.NullPointerException)

I am using the following:

Dim canvas1 as Canvas
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "bouvet-island.jpg")
Dim DestRect As Rect
DestRect.Initialize(10dip, 10dip, 10dip + 240dip, 10dip + 117dip)
canvas1.DrawBitmap(Bitmap1, Null, DestRect) 'draws the bitmap to the destination rectangle.

Any ideas?


Kind regards
Jakob
MaxApps
 

stevel05

Expert
Licensed User
Longtime User
Have you initialized the canvas?
 
Upvote 0

MaxApps

Active Member
Licensed User
Longtime User
How can I be so blind???

NO I forgot to initialize:BangHead:

Thank you. Its working now :)

Kind regards
Jakob
MaxApps
 
Upvote 0
Top