static DisplayMetrics getDisplayMetrics(final Context context) {
    final WindowManager
        windowManager =
        (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    final DisplayMetrics metrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getMetrics(metrics);
    return metrics;
  }
static DisplayMetrics getDisplayMetrics ( final Context context ) { final WindowManager windowManager = ( WindowManager ) context . getSystemService ( Context . WINDOW_SERVICE ) ; final DisplayMetrics metrics = new DisplayMetrics ( ) ; windowManager . getDefaultDisplay ( ) . getMetrics ( metrics ) ; return metrics ; }
Returns a valid DisplayMetrics object

@param context valid context
@return DisplayMetrics object