Saturday, February 2, 2013

Get screen resolution

The following code is to obtain screen resolution, through WindowManager.

WindowManager Wm = (WindowManager) Context.getSystemService(Context.WINDOW_SERVICE);Display D = Wm.getDefaultDisplay();MScreenWidth = D.getWidth();MScreenHeight = D.getHeight();//The following code gets condition column heightResources Res = Context.getResources();MStatusBarHeight = Context.getResources().getDimensionPixelSize(Com.android.internal.R.dimen.status_bar_height);//The following statement gets current configuration ConfigurationGetResources().getConfiguration()

No comments:

Post a Comment