I tried to use following code to get screen width and height in android app development:
Display display = getWindowManager().getDefaultDisplay();
int scree
From service:
Display display= ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
This is what finally worked for me:
DisplayMetrics metrics = this.getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;