myImage = BitmapFactory.decodeResource(getResources(), R.drawable.dirtmound);
Displaying this image later using canvas.drawBitmap works fine. But later I want to change the image that myImage refers to, so I use a line like this:
myImage = BitmapFactory.decodeResource(getResources(), R.drawable.clump);
After looking at things in the debug, it seems that myImage is indeed referring to the second image, but it isn't drawing. In my surfaceview's onDraw method I call the method canvas.drawBitmap using the variable myImage as the bitmap argument. The ondraw method is being called over and over in a while loop that i have going on in a thread called CanvasThread, which looks like this:
- Code: Select all
Canvas c;
while(_run)
{
counterUpdate();
c = null;
try
{
c = _surfaceHolder.lockCanvas(null);
synchronized (_surfaceHolder)
{
_panel.onDraw(c);
}
}
finally
{
//do this in a finally so that if an exception is thrown
//during the code above, we don't leave the surface in an
//inconsistent state.
if (c != null)
{
_surfaceHolder.unlockCanvasAndPost(c);
}
}
EDIT:
However, upon going through the debugger, I have found that my problem is that the onDraw method in my Panel calss (which extends SurfaceView) is never getting called. Does anyone know why this would be?

