I noticed that inside my class that extends View
, to get the screen size I have to use getContext
DisplayMetrics dispM = getContext.getResources().getDisplayMetrics();
int width = dispM.WidthPixels;
int height = dispM.HeightPixels;
if I wanted to do the same inside my Activity, I have to replace getContext
with getBaseContext
. Why is this the case?