If I put this in some activity class it works perfectly but, when I put it in my App class the method getWindowManager() can not be found. Is there some way to
getWindowManager()
Without Context use -
Resources.getSystem().displayMetrics.widthPixels
With Context -
context?.resources?.displayMetrics?.widthPixels
Note : getWindowManager().getDefaultDisplay().getMetrics(dm); returns void in the new API.
getWindowManager().getDefaultDisplay().getMetrics(dm);
void