I tried to use following code to get screen width and height in android app development:
Display display = getWindowManager().getDefaultDisplay(); int scree
DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int height = metrics.heightPixels; int width = metrics.widthPixels;
i guess the code which you wrote is deprecated.