title: lock canvas fail and canvas is null when useing SurfaceView
body: <p>The question of Android SurfaceView.
  I want to draw a Circle in SurfaceView ,but canvas is null in SimpleDraw method.Why?
  No 1 ,canvas is null.
  No 2,SimpleDraw method run in ClickListener,is right , canvas is not null,why?</p>
  
  <pre><code>1.public class SurfaceTestActivity extends Activity {
  SurfaceView sfv;
  SurfaceHolder sfh;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      sfv=(SurfaceView)findViewById(R.id.surface);
      sfh=sfv.getHolder();
      SimpleDraw();
  
  }
  
  void SimpleDraw(){
      Canvas canvas = sfh.lockCanvas(new Rect(0, 0, 300,
              getWindowManager().getDefaultDisplay().getHeight()));
      Paint mPaint = new Paint();
      mPaint.setColor(Color.GREEN);
      mPaint.setStrokeWidth(2);
      canvas.drawCircle(150, 150, 80, mPaint);
      sfh.unlockCanvasAndPost(canvas);
      }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>2.public class SurfaceTestActivity extends Activity {
  Button simpleButton;
  SurfaceView sfv;
  SurfaceHolder sfh;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      simpleButton=(Button)findViewById(R.id.simple);
      sfv=(SurfaceView)findViewById(R.id.surface);
      sfh=sfv.getHolder();
      simpleButton.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              //SimpleDraw();
          }
      });
  }
  
  void SimpleDraw(){
      Canvas canvas = sfh.lockCanvas(new Rect(0, 0, 300,
              getWindowManager().getDefaultDisplay().getHeight()));
      Paint mPaint = new Paint();
      mPaint.setColor(Color.GREEN);
      mPaint.setStrokeWidth(2);
      canvas.drawCircle(150, 150, 80, mPaint);
      sfh.unlockCanvasAndPost(canvas);
      }
  </code></pre>
  
  <p>}</p>