Any one knows that annotation are even supported in android ??? I see that I
can add annotations, but can not retrieve them using class methods.

On Wed, May 12, 2010 at 5:16 PM, Nehal <droidwond...@gmail.com> wrote:

> Just wanted to add that I get false for following line even if I have
> annotation added.
> if (methodList[i].isAnnotationPresent(MethodInfo.class))
>
> On May 12, 5:05 pm, Nehal <droidwond...@gmail.com> wrote:
> > Hello,
> > I am trying to use annotation - method.getAnnotation( ) or
> > method.isAnnotationPresent( ) and it is not working.
> >
> > I am using eclipse emulator for 2.1 OS version with JDK 1.6. Following
> > is information about what I did. Please advise if I am doing something
> > wrong.
> >
> > 1) Added annotation type
> > public static final int METHOD_UNDEFINED = -1;
> >
> >         public @interface MethodInfo {
> >                 int id() default METHOD_UNDEFINED;
> >         }
> >
> > 2) Added annotation for my method
> > final public static int METHOD_TESTMSG = 1;
> >
> > @MethodInfo(id=METHOD_TESTMSG)
> > public void testMsg(String msg, int data1, boolean bool1) {
> > // code here
> >
> > }
> >
> > 3) Now I am trying to find this method using annotation.
> > Method [] methodList = instanceClass.getDeclaredMethods();
> >                 for(int i=0; i< methodList.length; i++) {
> >                         if
> (methodList[i].isAnnotationPresent(MethodInfo.class)) {
> >                                 // stuff here
> >                         }
> >                 }
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to