title: How to get screen display metrics in application class
body: <p>If I put this in some activity class it works perfectly but, when I put it in my App class the method <code>getWindowManager()</code> can not be found. Is there some way to get the WindowManager in app class?</p>
  
  <p>My app class is defined like this:</p>
  
  <pre><code>public class myApp extends Application {
  </code></pre>
  
  <p>and in on create method I have this:</p>
  
  <pre><code>DisplayMetrics dm = new DisplayMetrics(); 
  getWindowManager().getDefaultDisplay().getMetrics(dm); 
  int width = dm.widthPixels;
  </code></pre>