I need to get the window height and the weight.
I have this in my code:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDispl
Where are you using this code?
The error of the getWindowManager
says that cannot find the method because the root of your class doesn't have it.
Try this:
((Activity) getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics);
or
((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay().getMetrics(metrics);
If this doesn't work, please paste your activity