I am using custom annotation to log the id which user clicked. But I am getting a error "Attribute value must be a constant". My code snippet is below.
mAssetId= Asset.getContentId();
@TrackEvent("track_event")
@ArrayParams({@Params(key = "content_id",value = mAssetId)})
protected void attributeMethod() {
}
Thanks in advance. Is there any way to pass dynamic values in annotation rather than static variables or constants. I am using AspectJ library for android.
It's not possible to specify runtime values in annotation attributes, only constants, and even the set of possible types is limited to a few types:
primitives, String, Class, enums, annotations, and arrays of the preceding types
according to the Java 5 Language Guide - Annotations.