title: Draw Rectangle on SurfaceView
body: <p>I would like to know how to draw a rectangle in specific position and size.</p>
  
  <p>I tried a couple of trials and examples here and on web, but nothing worked for me.</p>
  
  <p>I'm using a SurfaceView and SurfaceHolder to hold the camera preview.</p>
  
  <p>I just want to draw a rectangle when the user touch on the screen.</p>
  
  <p>I don't want to use external library and When I'm trying to get the canvas from the holder I'm getting null.</p>
  
  <p>For now there is no code, cause nothing work for me, if someone has a clue how to do it, I will try it.</p>
  
  <p>This is what I've already tried:</p>
  
  <p><a href="https://stackoverflow.com/questions/18192205/android-how-to-draw-a-rectangle-on-a-movable-image-such-that-the-drawn-rectangl">Link 1</a></p>
  
  <p><a href="http://www.c-sharpcorner.com/UploadFile/1e5156/learn-about-how-to-draw-rectangle-using-canvas-in-android-us/" rel="nofollow noreferrer">Link 2</a></p>
  
  <p><a href="http://android-coding.blogspot.co.il/2011/05/drawing-on-surfaceview.html" rel="nofollow noreferrer">Link 3</a></p>
  
  <p>Thanks for help! </p>