code: int getIdForResource(@NonNull Context context, @StyleableRes int index) {
          final int[] attrs = new int[]{index};
          final TypedArray typedArray = context.getTheme().obtainStyledAttributes(styleRes, attrs);
          int id = typedArray.getResourceId(0, -1);
          typedArray.recycle();
          return id;
      }
docs: Retrieves the resource id of the given Style index.
  
  @param context a valid Context
  @param index   The index to search on the Style definition.
  @return the id if found or -1.