Buggy code:
class LunarView extends SurfaceView implements SurfaceHolder . Callback { class LunarThread extends Thread { public static final int DIFFICULTY_EASY = 0 ; public static final int DIFFICULTY_HARD = 1 ; public static final int DIFFICULTY_MEDIUM = 2 ; public static final int PHYS_DOWN_ACCEL_SEC = 35 ; public static final int PHYS_FIRE_ACCEL_SEC = 80 ; public static final int PHYS_FUEL_INIT = 60 ; public static final int PHYS_FUEL_MAX = 100 ; public static final int PHYS_FUEL_SEC = 10 ; public static final int PHYS_SLEW_SEC = 120 ; public static final int PHYS_SPEED_HYPERSPACE = 180 ; public static final int PHYS_SPEED_INIT = 30 ; public static final int PHYS_SPEED_MAX = 120 ; public static final int STATE_LOSE = 1 ; public static final int STATE_PAUSE = 2 ; public static final int STATE_READY = 3 ; public static final int STATE_RUNNING = 4 ; public static final int STATE_WIN = 5 ; public static final int TARGET_ANGLE = 18 ; public static final int TARGET_BOTTOM_PADDING = 17 ; public static final int TARGET_PAD_HEIGHT = 8 ; public static final int TARGET_SPEED = 28 ; public static final double TARGET_WIDTH = 1.6 ; public static final int UI_BAR = 100 ; public static final int UI_BAR_HEIGHT = 10 ; private static final String KEY_DIFFICULTY = "mDifficulty" ; private static final String KEY_DX = "mDX" ; private static final String KEY_DY = "mDY" ; private static final String KEY_FUEL = "mFuel" ; private static final String KEY_GOAL_ANGLE = "mGoalAngle" ; private static final String KEY_GOAL_SPEED = "mGoalSpeed" ; private static final String KEY_GOAL_WIDTH = "mGoalWidth" ; private static final String KEY_GOAL_X = "mGoalX" ; private static final String KEY_HEADING = "mHeading" ; private static final String KEY_LANDER_HEIGHT = "mLanderHeight" ; private static final String KEY_LANDER_WIDTH = "mLanderWidth" ; private static final String KEY_WINS = "mWinsInARow" ; private static final String KEY_X = "mX" ; private static final String KEY_Y = "mY" ; private Bitmap mBackgroundImage ; private int mCanvasHeight = 1 ; private int mCanvasWidth = 1 ; private Drawable mCrashedImage ; private int mDifficulty ; private double mDX ; private double mDY ; private boolean mEngineFiring ; private Drawable mFiringImage ; private double mFuel ; private int mGoalAngle ; private int mGoalSpeed ; private int mGoalWidth ; private int mGoalX ; private Handler mHandler ; private double mHeading ; private int mLanderHeight ; private Drawable mLanderImage ; private int mLanderWidth ; private long mLastTime ; private Paint mLinePaint ; private Paint mLinePaintBad ; private int mMode ; private int mRotating ; private boolean mRun = false ; private RectF mScratchRect ; private SurfaceHolder mSurfaceHolder ; private int mWinsInARow ; private double mX ; private double mY ; public LunarThread ( SurfaceHolder surfaceHolder , Context context , Handler handler ) { } public void doStart ( ) { } public void pause ( ) { } public synchronized void restoreState ( Bundle savedState ) { } @ Override public void run ( ) { } public Bundle saveState ( Bundle map ) { } public void setDifficulty ( int difficulty ) { } public void setFiring ( boolean firing ) { } public void setRunning ( boolean b ) { } public void setState ( int mode ) { } public void setState ( int mode , CharSequence message ) { } public void setSurfaceSize ( int width , int height ) { synchronized ( mSurfaceHolder ) { mCanvasWidth = width ; mCanvasHeight = height ; <START_BUG> mBackgroundImage = Bitmap . createScaledBitmap ( mBackgroundImage , width , height , true ) ; <END_BUG> } } public void unpause ( ) { } boolean doKeyDown ( int keyCode , KeyEvent msg ) { } boolean doKeyUp ( int keyCode , KeyEvent msg ) { } private void doDraw ( Canvas canvas ) { } private void updatePhysics ( ) { } } private Context mContext ; private TextView mStatusText ; private LunarView . LunarThread mThread ; public LunarView ( Context context , AttributeSet attrs ) { } public LunarView . LunarThread getThread ( ) { } @ Override public boolean onKeyDown ( int keyCode , KeyEvent msg ) { } @ Override public boolean onKeyUp ( int keyCode , KeyEvent msg ) { } @ Override public void onWindowFocusChanged ( boolean hasWindowFocus ) { } public void setTextView ( TextView textView ) { } public void surfaceChanged ( SurfaceHolder holder , int format , int width , int height ) { } public void surfaceCreated ( SurfaceHolder holder ) { } public void surfaceDestroyed ( SurfaceHolder holder ) { } }

Fix:
mBackgroundImage = mBackgroundImage . createScaledBitmap ( mBackgroundImage , width , height , true ) ;