code: public static ColorStateList getColorStateList(Resources resources, int id) {
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
              return resources.getColorStateList(id, null);
          } else {
              return resources.getColorStateList(id);
          }
      }
docs: Returns a themed color state list associated with a particular resource
  ID. The resource may contain either a single raw color value or a
  complex {@link ColorStateList} holding multiple possible colors.
  
  @param resources Resources
  @param id        The desired resource identifier of a {@link ColorStateList},
  as generated by the aapt tool. This integer encodes the
  package, type, and resource entry. The value 0 is an invalid
  identifier.
  @return A themed ColorStateList object containing either a single solid
  color or multiple colors that can be selected based on a state.