I'm trying to create a canvas and draw a bitmap to it using the following code:
Paint paint = new Paint();
InputStream is = assets.open("card_art" + File.separator + "texture.png");
Bitmap bitmap = BitmapFactory.decodeStream(is);
cardFrontBackingImageView = new SurfaceView(Order.getContext()).getHolder().lockCanvas();
if (cardFrontBackingImageView == null)
{
Log.e("Canvas creation", "Canvas is null");
}
cardFrontBackingImageView.drawBitmap(bitmap, null, frame, paint);
The problem that I'm running into is the one that I'm checking for in the code--lockCanvas() is consistently returning null. I'm more or less learning this as I go along, so I don't know enough about the SurfaceView, SurfaceHolder, or Canvas to say one way or another what I might be doing wrong; any suggestions?