Let me start off with I'm mostly new to writing Java, so I would love for a complete explanation. Not just a spew of code, but something that gives some in site to why and where it should be
I'm currently attempting to write an Application, how ever I'm have some trouble with the Canvas and drawing the bitmap I would like onto it. This is my code to draw the image:
Canvas canvas = null;
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.image);
canvas.drawBitmap(image, 10, 800, null);
This method (expectantly) throws a Null Pointer Exception. However, Defining "canvas" as null is the only option Eclipse gives me. When attempting to define it as
Canvas canvas = new Canvas();
Android simply refuses to draw the bitmap. I'm sure my image is located at res/drawable/image If it helps, the image is saved as "image.png"
How would I make Android display/display my image/bitmap at the specific location I have asked it to draw the image (10x800)?