I'm trying to create a canvas from a PNG file that I have loaded into a bitmap, but it gives an error. Here's the code:
public Bitmap CABINET_Bitmap;
AssetManager assetManager = this.getAssets();
inputStream = assetManager.open("background.png");
CABINET_Bitmap = BitmapFactory.decodeStream(inputStream);
// Next line gives error
Canvas cv = new Canvas(CABINET_Bitmap);
If I create the bitmap, rather than load it in, by doing:
CABINET_Bitmap = Bitmap.createBitmap(480, 640, Config.RGB_565);
Canvas cv = new Canvas(CABINET_Bitmap);
Then the canvas creation works. Any ideas what I'm doing wrong?