bigdestroyer bigdestroyer - 1 year ago 71
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 (

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download