code: public static int getCount(Context context, Uri uri) {
          String[] proj = {"COUNT(*)"};
          return Cursors.firstInt(context.getContentResolver().query(uri, proj, null, null, null));
      }
docs: Get the number of rows at the URI.
  
  @return {@link Integer#MIN_VALUE} if the URI could not be queried
  @since 2.3.0