title: Android: How to find width and height of screen?
body: <p>I am trying to find the width and height of the screen but none of the ways I have tried will work in the class I created, my code is below. </p>
  
  <p>Does anyone know how to find it? I cannot use the way I am trying below because .getWidth() is deprecated?</p>
  
  <pre><code>public class Crate {
  
      public int acrossCrate;
      public int upDownCrate;
      Context theContext;
  
      WindowManager wm = (WindowManager)theContext.getSystemService(Context.WINDOW_SERVICE);
      Display display = wm.getDefaultDisplay();
      int width = display.getWidth();
  
  
      public Crate() {
      acrossCrate = 650;
      upDownCrate = 650;
      //int width = ;
      //int height = ;
  
    }
   } 
  </code></pre>