title: Taking a ScreenShot of SurfaceView with Camera Preview in it
body: <p>I am trying to Implement a Functionality that includes taking Pictures While Recording Video. That's the reason i have concluded to use the Screenshot approach of SurfaceView.<br/>
  However, when i try to take the Screen Shot of SurfaceView. I am always getting a Blank Image.<br/></p>
  
  <p>Here is the code that i am using for taking a Snapshot:</p>
  
  <pre><code>View tempView = (View)MY_SURFACE_VIEW;
  tempView.setDrawingCacheEnabled(true);
  Bitmap tempBmp = Bitmap.createBitmap(tempView.getDrawingCache());
  tempView.setDrawingCacheEnabled(false);
  //Saving this Bitmap to a File....
  </code></pre>
  
  <p>In case you guys may think this is a duplicate Question, let me assure you that i have tried the following Solutions provided on SO for the same Problem before asking this one. <br/></p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/24134964/issue-with-camera-picture-taken-snapshot-using-surfaceview-in-android">https://stackoverflow.com/questions/24134964/issue-with-camera-picture-taken-snapshot-using-surfaceview-in-android</a></li>
  <li><a href="https://stackoverflow.com/questions/11699611/facing-issue-to-take-a-screenshot-while-recording-a-video">Facing issue to take a screenshot while recording a video</a></li>
  <li><a href="https://stackoverflow.com/questions/13122134/take-camera-screenshot-while-recording-like-in-galaxy-s3">Take camera screenshot while recording - Like in Galaxy S3?</a></li>
  <li><a href="https://stackoverflow.com/questions/12724237/taking-screen-shot-of-a-surfaceview-in-android">Taking screen shot of a SurfaceView in android</a></li>
  <li><a href="https://stackoverflow.com/questions/15160598/get-screenshot-of-surfaceview-in-android">Get screenshot of surfaceView in Android</a> (This is the correct answer, but Partially Answered. I have already asked @sajar to Explain the Answer)</li>
  </ol>
  
  <p>Other Resources on Internet:<br/>
  1. <a href="http://www.coderanch.com/t/622613/Android/Mobile/capture-screenshot-simple-animation-project" rel="nofollow noreferrer">http://www.coderanch.com/t/622613/Android/Mobile/capture-screenshot-simple-animation-project</a>
  2. <a href="http://www.phonesdevelopers.com/1795894/" rel="nofollow noreferrer">http://www.phonesdevelopers.com/1795894/</a> <br/></p>
  
  <p>None of this has worked so far for me. I also know that we need to create some Thread that interacts with the Surface Holder and Gets the Bitmap from It. But i am not sure how to implement that. <br/></p>
  
  <p>Any Help is Highly Appreciated.</p>