I watched this post: Get screen sizes in pixels when I tried to determine the screen size of a device in a fragment class. One answer was close to what I needed, but the only code that ended for me was:
WindowManager wm = (WindowManager) getView().getContext().getSystemService(Context.WINDOW_SERVICE); Display screen = wm.getDefaultDisplay();
after which I could use getHeight (); or another not obsolete term.
source share