code: public static int generateViewId(){
          for (;;) {
              final int result = nextGeneratedViewId.get();
              // aapt-generated IDs have the high byte nonzero; clamp to the range under that.
              int newValue = result + 1;
              if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
              if (nextGeneratedViewId.compareAndSet(result, newValue)) {
                  return result;
              }
          }
      }
docs: Generate an available ID for the view.
  Uses the same implementation as {@link View#generateViewId}
  
  @return the next available view identifier.