title: Error getting window size on android: "The method getWindowManager is undefined"
body: <p>I need to get the window height and the weight.<br>
  I have this in my code:</p>
  
  <pre><code>DisplayMetrics metrics = new DisplayMetrics();
  getWindowManager().getDefaultDisplay().getMetrics(metrics);
  width1 = metrics.widthPixels; 
  height1 = metrics.heightPixels;
  </code></pre>
  
  <p>but I have an error: </p>
  
  <blockquote>
    <p>The method getWindowManager is undefined</p>
  </blockquote>
  
  <p>what i should import for this?
  or i can get the sizes of the screed in different ways?
  i have imported </p>
  
  <pre><code>import android.view.Display;
  import android.view.Window;
  import android.view.WindowManager;
  import android.content.Context;
  import android.util.DisplayMetrics;
  </code></pre>