code: protected static DisplayMetrics getDisplayMetrics(Context ctx) {
          try {
              return ctx.getResources().getDisplayMetrics();
          } catch (Exception e) {
              Log.e(TAG, "Error getting DisplayMetrics.", e);
              return null;
          }
      }
docs: Get the DisplayMetrics object for the current application.
  
  @param ctx Android application context
  @return the DisplayMetrics object for the current application