Get canvas height without drawing
<p>I wish to find out what dimensions my canvas is going to be long before I ever need to create one or draw on it.</p>

<p>The only canvas code I know (or have a flimsy knowledge of) is this:</p>

<pre><code>  final SurfaceHolder holder = getHolder();

  try 
  {
    Canvas canvas = holder.lockCanvas();
    if(canvas != null)
    {
      onDraw(canvas);
      holder.unlockCanvasAndPost(canvas);
    }
  } 
  catch (Exception e) 
  {
    e.printStackTrace();
  }
</code></pre>

<p>But this looks like it is doing far too much for simply getting the height. Is there a function like WhatHeightWillMyCanvasBeWhenIMakeOne()? </p>

<p><strong>EDIT:</strong> ...and if there isn't such a function, then what is a minimal piece of code for temporarily getting a canvas for long enough to ask its height and then get rid of it (if needed).</p>
