 <pre><code>protected Bitmap scaled = null; public void surfaceCreated(SurfaceHolder arg0) { Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.background); float scale = (float)background.getHeight()/(float)getHeight(); int newWidth = Math.round(background.getWidth()/scale); int newHeight = Math.round(background.getHeight()/scale); Bitmap scaled = Bitmap.createScaledBitmap(background, newWidth, newHeight, true); } public void onDraw(Canvas canvas) { canvas.drawBitmap(scaled, 0, 0, null); // draw the background } </code></pre>