Hello,
I'm new to android and I analyse example codes like Snake at the
moment to get a better feeling for android development. The most parts
are clear for me, but there is something I don't understand yet. In
this example there is the following code example:
public void loadTile(int key, Drawable tile) {
Bitmap bitmap = Bitmap.createBitmap(mTileSize, mTileSize,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
tile.setBounds(0, 0, mTileSize, mTileSize);
tile.draw(canvas);
mTileArray[key] = bitmap;
}
So every time a loadTile is executed (this is not just once) a new
Canvas will be created. What is the sense of more than one canvas? I
thought that a canvas is some kind of layer whereon you have to draw.
But obviously they instance multiple canvases. Is my thought about
what a canvas is wrong? In my opinion I only need one canvas. I
already wrote some testcode with a thread, a bouncing ball and a
background and I have only drawn to one canvas. So why do they use
more than one canvas?
Regards..
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe from this group, send email to
android-developers+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.