title: Get screen dimensions inside page adapter?
body: <p>I'm trying to get screen dimensions inside page adapter. I could get it inside <code>MainActivity</code> and pass it to the adapter but it would be better to get it there. How can I do it, either directly inside the adapter or inside <code>instantiateItem</code>?</p>
  
  <p>This is my code:</p>
  
  <pre><code>public class MyPagerAdapter extends PagerAdapter {
      Display display = getWindowManager().getDefaultDisplay(); // The method getWindowManager() is undefined for the type MyPagerAdapter
      display.getSize(size);
      ...
      }
  </code></pre>