아래의 코드는 무작위로 원을 생성하면서 화면에 뿌리는 간단한 소스입니다.

뷰를 생성시켜 보면 3개의 가상화면이 번갈아 가면서 출력됩니다. 혹시 이유를 알 수 있을까요?

public class RsView extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceViewThread thread;
private boolean hasSurface;
final private String TAG = "RsView";
public RsView(Context context) {
super(context);
// Log.d(TAG, "RsView constructor...");
init(context);
}
private void init(Context context) {
hasSurface = false;
SurfaceHolder holder;
holder = getHolder();
holder.addCallback(this);
Log.d(TAG, "init...");
}
public void pause() {
if (thread != null) {
thread.requestExitAndWait();
thread = null;
}
Log.d(TAG, "pause...");
}
public void resume() {
if (thread != null) {
if (hasSurface) {
thread.start();
}
}
Log.d(TAG, "resume...");
}

public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
if (thread != null) {
thread.onWindowResize(w, h);
}
Log.d(TAG, "curfaceChanged...");
}

public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "surface created");
hasSurface = true;
if (thread == null)
thread = new SurfaceViewThread(holder);

thread.start();
}

public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "surface destroyed");
hasSurface = false;
pause();
}

class SurfaceViewThread extends Thread {
private boolean done;
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
int width = 0;
int height = 0;
Random rand = new Random(System.currentTimeMillis());
SurfaceHolder holder;
int degree = 0;
SurfaceViewThread(SurfaceHolder holder) {
super();
done = false;
this.holder = holder;
Log.d(TAG, "creating thread...");
}
public void run() {
Canvas canvas;
while (!done) {
synchronized(holder) {
canvas = holder.lockCanvas();
try {
if (canvas == null)
break;
viewMain(canvas);
}
finally {
if (canvas == null)
break;
holder.unlockCanvasAndPost(canvas);
}
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public void requestExitAndWait() {
done = true;
try {
join();
}
catch (InterruptedException e) {
}
}
public void onWindowResize(int w, int h) {
Log.d(TAG, "resize (" + w + ", " + h + ")");
width = w;
height = h;
}
public void viewMain(Canvas canvas) {
int x, y, radius;
x = rand.nextInt(width);
y = rand.nextInt(height);
radius = rand.nextInt(100);

paint.setARGB(rand.nextInt(255), 
rand.nextInt(255), 
rand.nextInt(255), 
rand.nextInt(255));

canvas.rotate(degree++%360, width/2, height/2);
canvas.drawCircle(x, y, radius, paint);
}
}