Proper way to get DisplayMetrics: getResources() or getWindowManager()
<p>What's the proper way to get DisplayMetrics, i.e. get screen/display info such as <code>density</code> or <code>xdpi</code>?</p>

<p>I ask because I've seen two ways of going about this:</p>

<p>FIRST:</p>

<pre><code>    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
</code></pre>

<p>then getting the info by <code>metrics.density</code> or <code>metrics.xdpi</code>, etc</p>

<p>SECOND:</p>

<pre><code>    getResources().getDisplayMetrics().density
</code></pre>

<p>in this method I believe you can also just initialize a variable to hold the DisplayMetric and then grab info like in the FIRST method:</p>

<pre><code>    DisplayMetrics metricsMethodTwo = getResources().getDisplayMetrics()
</code></pre>

<p>and then you can get info like normal: <code>metricsMethodTwo.density</code> or <code>metricsMethodTwo.xdpi</code></p>

<p>I've seen both in various places in the Docs. So what are the differences if any, and when is one method favored (or more appropriate) over the other and why? Thanks</p>
