Android examples for java.lang.reflect:Annotation
get Annotation Value
//package com.java2s; import java.lang.annotation.Annotation; public class Main { public static final String VALUE_NAME = "value"; public static Object getAnnotationValue(Annotation annotation) { return getAnnotationValueWithName(annotation, VALUE_NAME); }/*w w w.j a v a2 s. c om*/ public static Object getAnnotationValueWithName(Annotation annotation, String valueName) { try { return annotation.annotationType().getMethod(valueName) .invoke(annotation); } catch (Exception e) { return null; } } }