I need to get the window height and the weight.
I have this in my code:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
width1 = metrics.widthPixels;
height1 = metrics.heightPixels;
but I have an error:
The method getWindowManager is undefined
what i should import for this? or i can get the sizes of the screed in different ways? i have imported
import android.view.Display;
import android.view.Window;
import android.view.WindowManager;
import android.content.Context;
import android.util.DisplayMetrics;