Let's look at the code and the different stages required to get drawing, then we can quickly move on to drawing something for real with the Canvas demo app.
The first step is to turn the classes we need into real, working things, objects/instances.
First we state the type, which in this case happens to be a class, and then we state the name we would like our working object to have:
// Here are all the objects(instances) // of classes that we need to do some drawing ImageView myImageView; Bitmap myBlankBitmap; Canvas myCanvas; Paint myPaint;
The previous code declares reference type variables of the ImageView
, Bitmap
, Canvas
, and Paint
types. They are named myImageView
, myBlankBitmap
, myCanvas
, and myPaint
, respectively.