title: Drawing WebView into set position on Canvas
body: <p>I have created a custom WebView, which will be used to play a gif file. Now I need to draw this to my canvas in a specific position and using a set size. </p>
  
  <p>However, I am not entirly sure how I can convert this webView containing Gif into a Bitmap so that I can insert it into the correct location on my Canvas.</p>
  
  <p>My WebView Class:</p>
  
  <pre><code>public class finishWebView extends WebView
  {
  
      public finishWebView(Context context, String path) 
      {
          super(context);
          loadUrl(path);
      }
  }
  </code></pre>
  
  <p>Getting the raw resource for main Activity:</p>
  
  <pre><code>finishWebView view = new finishWebView(context, "file:///android_asset/test.gif");
  </code></pre>
  
  <p>The orginal code to convert my image to the correct size and insert into canvas:    </p>
  
  <pre><code>finish = BitmapFactory.decodeResource(getResources(), R.drawable.finish);
  finish = Bitmap.createScaledBitmap(finish, (PhoneWidth / 5), (PhoneWidth / 5), true);
  
  protected void onDraw(Canvas canvas)
  {
      canvas.drawBitmap(finish, (j * totalCellWidth), (i * totalCellHeight), null);
  }
  </code></pre>
  
  <p>So essentially, I need to work out a way to draw the webView with gif image displaying onto the specified locations within my canvas, similar to what I am currently doing with 'canvas.drawBitmap(...)'.</p>
  
  <p>----------------------------------- EDIT ----------------------------------------</p>
  
  <p>Using the code snippet mentioned provided by mikejonesguy, I have got to here, however this now just displays a blank screen.</p>
  
  <pre><code>public static Bitmap createBitmapFromView(View v) {
      Bitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.RGB_565);
      Canvas c = new Canvas(b);
      v.draw(c);
      return b;
  }
  
  // Within onDraw
  GIFView gifView = new GIFView(context);
  canvas.drawBitmap(createBitmapFromView(gifView), (j * totalCellWidth), (i * totalCellHeight), null);
  </code></pre>
  
  <p>I have tested my GIFView on normal xml layout pages and it works correctly, just cannot get it inserted into my canvas.</p>