Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

IntRange

@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.ANNOTATION_CLASS]) class IntRange
androidx.annotation.IntRange

Denotes that the annotated element should be an int or long in the given range

Example:

<code>
   @IntRange(from=0,to=255)
   public int getAlpha() {
       ...
   }
  </code>

Summary

Public constructors

<init>(from: Long, to: Long)

Denotes that the annotated element should be an int or long in the given range

Properties

Long

Smallest value, inclusive

Long

Largest value, inclusive

Public constructors

<init>

IntRange(from: Long, to: Long)

Denotes that the annotated element should be an int or long in the given range

Example:

<code>
   @IntRange(from=0,to=255)
   public int getAlpha() {
       ...
   }
  </code>

Properties

from

val from: Long

Smallest value, inclusive

to

val to: Long

Largest value, inclusive