DisplayMetrics dm; dm = new DisplayMetrics(); WindowManager wm = getContext().getWindowManager(); wm.getDefaultDisplay().getMetrics(dm); int w = dm.widthPixels; int h = dm.heightPixels;