bigdestroyer bigdestroyer - 6 months ago 34
Android Question

Is there a support annotation to denote binding resources?

denotes a layout resource (
a color resource (
), and so on. Is there any Android support annotation that denotes a binding resource (


Data binding is a relatively new feature, and there is no specific annotation for its resources yet. However, you can use @AnyRes as a substitute for now.

See annotation docs:

Use @AnyRes to indicate that the annotated parameter can be any type of R resource.

and AnyRes docs:

public interface AnyRes extends annotation.Annotation

Denotes that an integer parameter, field or method return value is expected to be a resource reference of any type. If the specific type is known, use one of the more specific annotations instead, such as StringRes or DrawableRes.