code: @Nullable
      private Display currentDisplay() {
          if (Build.VERSION.SDK_INT >= JELLY_BEAN_MR1) {
              return getDisplay();
          } else {
              Context context = getContext();
              if (!(context instanceof Activity)) {
                  return null;
              }
              return ((Activity) context).getWindowManager().getDefaultDisplay();
          }
      }
docs: Get a {@link Display} object suitable for checking the refresh rate.