I need to get the window height and the weight. I have this in my code:
DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDispl
Use the Context of the activity with getActivityContext()
Context
getActivityContext()
DisplayMetrics metrics = new DisplayMetrics(); getActivityContext().getWindowManager().getDefaultDisplay().getMetrics(metrics); width1 = metrics.widthPixels; height1 = metrics.heightPixels;